-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from StenopePHP/content_manager_interface
Add a ContentManagerInterface
- Loading branch information
Showing
14 changed files
with
115 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the "StenopePHP/Stenope" bundle. | ||
* | ||
* @author Thomas Jarrand <thomas.jarrand@gmail.com> | ||
*/ | ||
|
||
namespace Stenope\Bundle; | ||
|
||
use Stenope\Bundle\ReverseContent\Context; | ||
use Symfony\Component\ExpressionLanguage\Expression; | ||
|
||
interface ContentManagerInterface | ||
{ | ||
/** | ||
* List all content for the given type | ||
* | ||
* @template T | ||
* | ||
* @param class-string<T> $type Model FQCN e.g. "App/Model/Article" | ||
* @param string|array|callable $sortBy String, array or callable | ||
* @param string|array|callable|Expression $filterBy Array, callable or an {@link Expression} instance / string | ||
* to filter out with an expression using the ExpressionLanguage | ||
* component. | ||
* | ||
* @return array<string,T> List of decoded contents with their slug as key | ||
*/ | ||
public function getContents(string $type, $sortBy = null, $filterBy = null): array; | ||
|
||
/** | ||
* Fetch a specific content | ||
* | ||
* @template T | ||
* | ||
* @param class-string<T> $type Model FQCN e.g. "App/Model/Article" | ||
* @param string $id Unique identifier (slug) | ||
* | ||
* @return T An object of the given type. | ||
*/ | ||
public function getContent(string $type, string $id): object; | ||
|
||
/** | ||
* Attempt to reverse resolve a content according to a context. | ||
* E.g: attempt to resolve a content relative to another one through its filesystem path. | ||
*/ | ||
public function reverseContent(Context $context): ?Content; | ||
|
||
public function supports(string $type): bool; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.