1 | <?php |
||
26 | class CollectionManager extends TrackingManager |
||
27 | { |
||
28 | /** @var string[][] A copy of the collection definitions to be available for later usage. */ |
||
29 | private $collectionDefinitions; |
||
30 | private $markupEngineManager; |
||
31 | private $configuration; |
||
32 | private $eventDispatcher; |
||
33 | private $templateBridge; |
||
34 | private $logger; |
||
35 | |||
36 | /** |
||
37 | * CollectionManager constructor. |
||
38 | */ |
||
39 | 36 | public function __construct(MarkupEngineManager $markupEngineManager, Configuration $configuration, TemplateBridgeInterface $templateBridge, EventDispatcherInterface $eventDispatcher, LoggerInterface $logger) |
|
40 | { |
||
41 | 36 | $this->markupEngineManager = $markupEngineManager; |
|
42 | 36 | $this->configuration = $configuration; |
|
43 | 36 | $this->eventDispatcher = $eventDispatcher; |
|
44 | 36 | $this->templateBridge = $templateBridge; |
|
45 | 36 | $this->logger = $logger; |
|
46 | 36 | } |
|
47 | |||
48 | /** |
||
49 | * {@inheritdoc} |
||
50 | */ |
||
51 | 6 | public function compileManager() |
|
62 | |||
63 | /** |
||
64 | * Get all of the ContentItems grouped by Collection name. |
||
65 | * |
||
66 | * ```php |
||
67 | * [ |
||
68 | * 'collection name' => [ |
||
69 | * new ContentItem(), |
||
70 | * new ContentItem(), |
||
71 | * ] |
||
72 | * ] |
||
73 | * ``` |
||
74 | * |
||
75 | * @return ContentItem[][] |
||
76 | */ |
||
77 | 15 | public function &getCollections() |
|
81 | |||
82 | /** |
||
83 | * Get a ContentItem from a Collection passed on it's path. |
||
84 | * |
||
85 | * @param string $filePath |
||
86 | * |
||
87 | * @throws TrackedItemNotFoundException |
||
88 | * |
||
89 | * @return ContentItem |
||
90 | */ |
||
91 | 1 | public function &getContentItem($filePath) |
|
100 | |||
101 | /** |
||
102 | * A jailed representation of CollectionManager::getCollections(). |
||
103 | * |
||
104 | * @return JailedDocument[][] |
||
|
|||
105 | */ |
||
106 | public function getJailedCollections() |
||
112 | |||
113 | /** |
||
114 | * Parse every collection and store them in the manager. |
||
115 | * |
||
116 | * @param string[][] $collections An array of definitions for collections |
||
117 | */ |
||
118 | 36 | public function parseCollections($collections) |
|
164 | |||
165 | /** |
||
166 | * {@inheritdoc} |
||
167 | */ |
||
168 | 1 | public function createNewItem($filePath) |
|
176 | |||
177 | /** |
||
178 | * {@inheritdoc} |
||
179 | */ |
||
180 | public function refreshItem($filePath) |
||
183 | |||
184 | /** |
||
185 | * {@inheritdoc} |
||
186 | */ |
||
187 | 36 | protected function handleTrackableItem(File $filePath, array $options = []) |
|
211 | |||
212 | /** |
||
213 | * Get the name of the Collection this ContentItem belongs to based on its location. |
||
214 | * |
||
215 | * @param File $file |
||
216 | * |
||
217 | * @return string |
||
218 | */ |
||
219 | 1 | private function getCollectionNameFromPath(File $file) |
|
231 | } |
||
232 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.