1 | <?php |
||
25 | class RouteDispatcher |
||
|
|||
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 staticPageViewController(StaticPageView $pageView, Compiler $compiler) |
||
64 | |||
65 | /** |
||
66 | * Build a controller for handling a Dynamic PageView's URL. |
||
67 | * |
||
68 | * @param DynamicPageView $pageView |
||
69 | * @param Compiler $compiler |
||
70 | * |
||
71 | * @return \Closure |
||
72 | */ |
||
73 | private function dynamicPageViewController(DynamicPageView $pageView, Compiler $compiler) |
||
98 | |||
99 | /** |
||
100 | * Build a controller for handling a Repeater PageView's URL. |
||
101 | * |
||
102 | * @param RepeaterPageView $pageView |
||
103 | * @param Compiler $compiler |
||
104 | * |
||
105 | * @return \Closure |
||
106 | */ |
||
107 | private function repeaterPageViewController(RepeaterPageView $pageView, Compiler $compiler) |
||
127 | |||
128 | /** |
||
129 | * Return the appropriate controller based on a PageView's type. |
||
130 | * |
||
131 | * @param BasePageView|DynamicPageView|RepeaterPageView|StaticPageView $pageView |
||
132 | * @param Compiler $compiler |
||
133 | * |
||
134 | * @return \Closure |
||
135 | */ |
||
136 | private function createController(BasePageView $pageView, Compiler $compiler) |
||
157 | |||
158 | /** |
||
159 | * Check to see if a file has been touched since we last read it. |
||
160 | * |
||
161 | * @param ReadableDocument $document |
||
162 | * |
||
163 | * @return bool True if the file has been modified since it was last accessed |
||
164 | */ |
||
165 | private function hasBeenTouched(ReadableDocument $document) |
||
178 | |||
179 | /** |
||
180 | * Create a FastRoute Dispatcher. |
||
181 | * |
||
182 | * @param PageViewRouter $router |
||
183 | * @param Compiler $compiler |
||
184 | * |
||
185 | * @return \FastRoute\Dispatcher |
||
186 | */ |
||
187 | public static function create(PageViewRouter $router, Compiler $compiler) |
||
200 | |||
201 | /** |
||
202 | * Normalize a given URL. |
||
203 | * |
||
204 | * A normalized URL is one with `baseurl` stripped away from it. This is necessary because all permalinks in stakx |
||
205 | * are handled without the base so it's necessary to be able to reference correct correct permalinks. |
||
206 | * |
||
207 | * @param string $url |
||
208 | * |
||
209 | * @return mixed |
||
210 | */ |
||
211 | public static function normalizeUrl($url) |
||
215 | |||
216 | /** |
||
217 | * Find a ContentItem from a Dynamic PageView or null if it doesn't exist. |
||
218 | * |
||
219 | * @param DynamicPageView $pageView |
||
220 | * @param $permalink |
||
221 | * |
||
222 | * @return CollectableItem|ReadableDocument|TemplateReadyDocument|null |
||
223 | */ |
||
224 | private static function getContentItem(DynamicPageView $pageView, $permalink) |
||
238 | |||
239 | /** |
||
240 | * Find the ExpandedValue from a Repeater PageView or null if it doesn't exist. |
||
241 | * |
||
242 | * @param RepeaterPageView $pageView |
||
243 | * @param $permalink |
||
244 | * |
||
245 | * @return ExpandedValue|null |
||
246 | */ |
||
247 | private static function getExpandedValue(RepeaterPageView $pageView, $permalink) |
||
262 | } |
||
263 |