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 | * Create a redirect response to forward. |
||
166 | * |
||
167 | * @param string $to The destination URL |
||
168 | * |
||
169 | * @return \Closure |
||
170 | */ |
||
171 | private function createRedirectAction($to) |
||
179 | |||
180 | /** |
||
181 | * Check to see if a file has been touched since we last read it. |
||
182 | * |
||
183 | * @param ReadableDocument $document |
||
184 | * |
||
185 | * @return bool True if the file has been modified since it was last accessed |
||
186 | */ |
||
187 | private function hasBeenTouched(ReadableDocument $document) |
||
200 | |||
201 | /** |
||
202 | * Create a FastRoute Dispatcher. |
||
203 | * |
||
204 | * @param RouteMapper $router |
||
205 | * @param Compiler $compiler |
||
206 | * |
||
207 | * @return \FastRoute\Dispatcher |
||
208 | */ |
||
209 | public static function create(RouteMapper $router, Compiler $compiler) |
||
227 | |||
228 | /** |
||
229 | * Normalize a given URL. |
||
230 | * |
||
231 | * A normalized URL is one with `baseurl` stripped away from it. This is necessary because all permalinks in stakx |
||
232 | * are handled without the base so it's necessary to be able to reference correct correct permalinks. |
||
233 | * |
||
234 | * @param string $url |
||
235 | * |
||
236 | * @return mixed |
||
237 | */ |
||
238 | public static function normalizeUrl($url) |
||
242 | |||
243 | /** |
||
244 | * Find a ContentItem from a Dynamic PageView or null if it doesn't exist. |
||
245 | * |
||
246 | * @param DynamicPageView $pageView |
||
247 | * @param $permalink |
||
248 | * |
||
249 | * @return CollectableItem|ReadableDocument|TemplateReadyDocument|null |
||
250 | */ |
||
251 | private static function getContentItem(DynamicPageView $pageView, $permalink) |
||
265 | |||
266 | /** |
||
267 | * Find the ExpandedValue from a Repeater PageView or null if it doesn't exist. |
||
268 | * |
||
269 | * @param RepeaterPageView $pageView |
||
270 | * @param $permalink |
||
271 | * |
||
272 | * @return ExpandedValue|null |
||
273 | */ |
||
274 | private static function getExpandedValue(RepeaterPageView $pageView, $permalink) |
||
289 | } |
||
290 |