1 | <?php |
||
25 | class Controller |
||
|
|||
26 | { |
||
27 | private static $baseUrl = ''; |
||
28 | private $lastModified = []; |
||
29 | |||
30 | /** |
||
31 | * @internal |
||
32 | */ |
||
33 | private function __construct() |
||
36 | |||
37 | /** |
||
38 | * Build a controller for handling a Static PageView's URL. |
||
39 | * |
||
40 | * @param StaticPageView $pageView |
||
41 | * @param Compiler $compiler |
||
42 | * |
||
43 | * @return \Closure |
||
44 | */ |
||
45 | private function staticPageViewAction(StaticPageView $pageView, Compiler $compiler) |
||
66 | |||
67 | /** |
||
68 | * Build a controller for handling a Dynamic PageView's URL. |
||
69 | * |
||
70 | * @param DynamicPageView $pageView |
||
71 | * @param Compiler $compiler |
||
72 | * |
||
73 | * @return \Closure |
||
74 | */ |
||
75 | private function dynamicPageViewAction(DynamicPageView $pageView, Compiler $compiler) |
||
102 | |||
103 | /** |
||
104 | * Build a controller for handling a Repeater PageView's URL. |
||
105 | * |
||
106 | * @param RepeaterPageView $pageView |
||
107 | * @param Compiler $compiler |
||
108 | * |
||
109 | * @return \Closure |
||
110 | */ |
||
111 | private function repeaterPageViewAction(RepeaterPageView $pageView, Compiler $compiler) |
||
133 | |||
134 | /** |
||
135 | * Return the appropriate action based on a PageView's type. |
||
136 | * |
||
137 | * @param BasePageView|DynamicPageView|RepeaterPageView|StaticPageView $pageView |
||
138 | * @param Compiler $compiler |
||
139 | * |
||
140 | * @return \Closure |
||
141 | */ |
||
142 | private function createAction(BasePageView $pageView, Compiler $compiler) |
||
163 | |||
164 | /** |
||
165 | * Check to see if a file has been touched since we last read it. |
||
166 | * |
||
167 | * @param ReadableDocument $document |
||
168 | * |
||
169 | * @return bool True if the file has been modified since it was last accessed |
||
170 | */ |
||
171 | private function hasBeenTouched(ReadableDocument $document) |
||
184 | |||
185 | /** |
||
186 | * Create a FastRoute Dispatcher. |
||
187 | * |
||
188 | * @param RouteMapper $router |
||
189 | * @param Compiler $compiler |
||
190 | * |
||
191 | * @return \FastRoute\Dispatcher |
||
192 | */ |
||
193 | public static function create(RouteMapper $router, Compiler $compiler) |
||
206 | |||
207 | /** |
||
208 | * Normalize a given URL. |
||
209 | * |
||
210 | * A normalized URL is one with `baseurl` stripped away from it. This is necessary because all permalinks in stakx |
||
211 | * are handled without the base so it's necessary to be able to reference correct correct permalinks. |
||
212 | * |
||
213 | * @param string $url |
||
214 | * |
||
215 | * @return mixed |
||
216 | */ |
||
217 | public static function normalizeUrl($url) |
||
221 | |||
222 | /** |
||
223 | * Find a ContentItem from a Dynamic PageView or null if it doesn't exist. |
||
224 | * |
||
225 | * @param DynamicPageView $pageView |
||
226 | * @param $permalink |
||
227 | * |
||
228 | * @return CollectableItem|ReadableDocument|TemplateReadyDocument|null |
||
229 | */ |
||
230 | private static function getContentItem(DynamicPageView $pageView, $permalink) |
||
244 | |||
245 | /** |
||
246 | * Find the ExpandedValue from a Repeater PageView or null if it doesn't exist. |
||
247 | * |
||
248 | * @param RepeaterPageView $pageView |
||
249 | * @param $permalink |
||
250 | * |
||
251 | * @return ExpandedValue|null |
||
252 | */ |
||
253 | private static function getExpandedValue(RepeaterPageView $pageView, $permalink) |
||
268 | } |
||
269 |