1 | <?php |
||
31 | class PageManager extends TrackingManager |
||
32 | { |
||
33 | /** @var StaticPageView[] A place to store a reference to static PageViews with titles. */ |
||
34 | private $staticPages; |
||
35 | private $configuration; |
||
36 | private $collectionManager; |
||
37 | private $dataManager; |
||
38 | private $eventDispatcher; |
||
39 | private $logger; |
||
40 | |||
41 | /** |
||
42 | * PageManager constructor. |
||
43 | */ |
||
44 | 19 | public function __construct(Configuration $configuration, CollectionManager $collectionManager, DataManager $dataManager, EventDispatcherInterface $eventDispatcher, LoggerInterface $logger) |
|
58 | |||
59 | /** |
||
60 | * {@inheritdoc} |
||
61 | */ |
||
62 | 7 | public function compileManager() |
|
66 | |||
67 | /** |
||
68 | * Go through all of the PageView directories and create a respective PageView for each and classify them by type. |
||
69 | * |
||
70 | * @param string[] $pageViewFolders |
||
71 | * |
||
72 | * @since 0.1.0 |
||
73 | */ |
||
74 | 19 | public function parsePageViews(array $pageViewFolders) |
|
91 | |||
92 | /** |
||
93 | * Get all of the PageViews in an associative array with PageView types as the keys. |
||
94 | * |
||
95 | * @since 0.1.1 |
||
96 | * |
||
97 | * @return BasePageView[][] |
||
98 | */ |
||
99 | public function &getPageViews() |
||
103 | |||
104 | /** |
||
105 | * Get all of the PageViews in flat array. |
||
106 | * |
||
107 | * @since 0.1.1 |
||
108 | * |
||
109 | * @return BasePageView[] |
||
110 | */ |
||
111 | 17 | public function &getPageViewsFlattened() |
|
115 | |||
116 | /** |
||
117 | * Get the static PageViews tracked by this manager indexed by their title. |
||
118 | * |
||
119 | * @since 0.1.0 |
||
120 | * |
||
121 | * @return StaticPageView[] |
||
122 | */ |
||
123 | 1 | public function getStaticPageViews() |
|
127 | |||
128 | /** |
||
129 | * Get the jailed version of the static PageViews indexed by their title. |
||
130 | * |
||
131 | * @since 0.1.0 |
||
132 | * |
||
133 | * @return JailedDocument[] |
||
134 | */ |
||
135 | 13 | public function getJailedStaticPageViews() |
|
146 | |||
147 | /** |
||
148 | * Add a new ContentItem to the respective parent PageView of the ContentItem. |
||
149 | * |
||
150 | * @param ContentItem $contentItem |
||
151 | * |
||
152 | * @since 0.1.0 |
||
153 | */ |
||
154 | 1 | public function trackNewContentItem(&$contentItem) |
|
159 | |||
160 | /** |
||
161 | * {@inheritdoc} |
||
162 | */ |
||
163 | 18 | protected function &handleTrackableItem(File $filePath, array $options = []) |
|
164 | { |
||
165 | 18 | $pageView = BasePageView::create($filePath, [ |
|
166 | 18 | 'site' => $this->configuration->getConfiguration(), |
|
167 | ]); |
||
168 | 18 | $namespace = $pageView->getType(); |
|
169 | |||
170 | switch ($namespace) |
||
171 | { |
||
172 | 18 | case BasePageView::STATIC_TYPE: |
|
173 | 11 | $this->handleTrackableStaticPageView($pageView); |
|
174 | 11 | break; |
|
175 | |||
176 | 7 | case BasePageView::DYNAMIC_TYPE: |
|
177 | 4 | $this->handleTrackableDynamicPageView($pageView); |
|
178 | 3 | break; |
|
179 | |||
180 | 3 | case BasePageView::REPEATER_TYPE: |
|
181 | 3 | $this->handleTrackableRepeaterPageView($pageView); |
|
182 | 3 | break; |
|
183 | |||
184 | default: |
||
185 | break; |
||
186 | } |
||
187 | |||
188 | 17 | $this->addObjectToTracker($pageView, $namespace); |
|
189 | |||
190 | 17 | return $pageView; |
|
191 | } |
||
192 | |||
193 | /** |
||
194 | * Handle special behavior and treatment for static PageViews while we're iterating through them. |
||
195 | * |
||
196 | * @param StaticPageView $pageView |
||
197 | * |
||
198 | * @since 0.1.0 |
||
199 | */ |
||
200 | 11 | private function handleTrackableStaticPageView(&$pageView) |
|
213 | |||
214 | /** |
||
215 | * Handle special behavior and treatment for dynamic PageViews while we're iterating through them. |
||
216 | * |
||
217 | * @param DynamicPageView $pageView |
||
218 | * |
||
219 | * @since 0.1.0 |
||
220 | * |
||
221 | * @throws \Exception |
||
222 | */ |
||
223 | 4 | private function handleTrackableDynamicPageView(&$pageView) |
|
264 | |||
265 | /** |
||
266 | * Handle special behavior and treatment for repeater PageViews while we're iterating through them. |
||
267 | * |
||
268 | * @param RepeaterPageView $pageView |
||
269 | * |
||
270 | * @since 0.2.0 |
||
271 | */ |
||
272 | 3 | private function handleTrackableRepeaterPageView(&$pageView) |
|
279 | } |
||
280 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: