@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | * |
207 | 207 | * @param string $url |
208 | 208 | * |
209 | - * @return mixed |
|
209 | + * @return string |
|
210 | 210 | */ |
211 | 211 | public static function normalizeUrl($url) |
212 | 212 | { |
@@ -217,9 +217,9 @@ discard block |
||
217 | 217 | * Find a ContentItem from a Dynamic PageView or null if it doesn't exist. |
218 | 218 | * |
219 | 219 | * @param DynamicPageView $pageView |
220 | - * @param $permalink |
|
220 | + * @param string $permalink |
|
221 | 221 | * |
222 | - * @return CollectableItem|ReadableDocument|TemplateReadyDocument|null |
|
222 | + * @return CollectableItem|null |
|
223 | 223 | */ |
224 | 224 | private static function getContentItem(DynamicPageView $pageView, $permalink) |
225 | 225 | { |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | * Find the ExpandedValue from a Repeater PageView or null if it doesn't exist. |
241 | 241 | * |
242 | 242 | * @param RepeaterPageView $pageView |
243 | - * @param $permalink |
|
243 | + * @param string $permalink |
|
244 | 244 | * |
245 | 245 | * @return ExpandedValue|null |
246 | 246 | */ |
@@ -44,7 +44,8 @@ discard block |
||
44 | 44 | */ |
45 | 45 | private function staticPageViewAction(StaticPageView $pageView, Compiler $compiler) |
46 | 46 | { |
47 | - return function () use ($pageView, $compiler) { |
|
47 | + return function () use ($pageView, $compiler) |
|
48 | + { |
|
48 | 49 | Service::setOption('currentTemplate', $pageView->getAbsoluteFilePath()); |
49 | 50 | |
50 | 51 | $compiler->getTemplateBridge()->clearTemplateCache(); |
@@ -74,7 +75,8 @@ discard block |
||
74 | 75 | */ |
75 | 76 | private function dynamicPageViewAction(DynamicPageView $pageView, Compiler $compiler) |
76 | 77 | { |
77 | - return function (ServerRequestInterface $request) use ($pageView, $compiler) { |
|
78 | + return function (ServerRequestInterface $request) use ($pageView, $compiler) |
|
79 | + { |
|
78 | 80 | Service::setOption('currentTemplate', $pageView->getAbsoluteFilePath()); |
79 | 81 | |
80 | 82 | $compiler->getTemplateBridge()->clearTemplateCache(); |
@@ -110,7 +112,8 @@ discard block |
||
110 | 112 | */ |
111 | 113 | private function repeaterPageViewAction(RepeaterPageView $pageView, Compiler $compiler) |
112 | 114 | { |
113 | - return function (ServerRequestInterface $request) use ($pageView, $compiler) { |
|
115 | + return function (ServerRequestInterface $request) use ($pageView, $compiler) |
|
116 | + { |
|
114 | 117 | Service::setOption('currentTemplate', $pageView->getAbsoluteFilePath()); |
115 | 118 | |
116 | 119 | $compiler->getTemplateBridge()->clearTemplateCache(); |
@@ -153,7 +156,8 @@ discard block |
||
153 | 156 | return $this->repeaterPageViewAction($pageView, $compiler); |
154 | 157 | |
155 | 158 | default: |
156 | - return function () { |
|
159 | + return function () |
|
160 | + { |
|
157 | 161 | $errMsg = 'This URL type has not yet been implemented.'; |
158 | 162 | |
159 | 163 | return new Response(501, ['Content-Type' => 'text/plain'], $errMsg); |
@@ -194,7 +198,8 @@ discard block |
||
194 | 198 | { |
195 | 199 | self::$baseUrl = $router->getBaseUrl(); |
196 | 200 | |
197 | - return \FastRoute\simpleDispatcher(function (RouteCollector $r) use ($router, $compiler) { |
|
201 | + return \FastRoute\simpleDispatcher(function (RouteCollector $r) use ($router, $compiler) |
|
202 | + { |
|
198 | 203 | $dispatcher = new Controller(); |
199 | 204 | |
200 | 205 | foreach ($router->getRouteMapping() as $route => $pageView) |
@@ -60,7 +60,8 @@ |
||
60 | 60 | */ |
61 | 61 | public function clearImportCache($file = null) |
62 | 62 | { |
63 | - if ($file === null) { |
|
63 | + if ($file === null) |
|
64 | + { |
|
64 | 65 | $this->importCache = []; |
65 | 66 | return; |
66 | 67 | } |
@@ -59,7 +59,8 @@ discard block |
||
59 | 59 | { |
60 | 60 | $dispatcher = Controller::create($router, $compiler); |
61 | 61 | |
62 | - return new Server(function (ServerRequestInterface $request) use ($router, $dispatcher, $compiler) { |
|
62 | + return new Server(function (ServerRequestInterface $request) use ($router, $dispatcher, $compiler) |
|
63 | + { |
|
63 | 64 | $httpMethod = $request->getMethod(); |
64 | 65 | $urlPath = Controller::normalizeUrl($request->getUri()->getPath()); |
65 | 66 | |
@@ -77,7 +78,8 @@ discard block |
||
77 | 78 | case Dispatcher::FOUND: |
78 | 79 | $urlPlaceholders = isset($routeInfo[2]) ? $routeInfo[2] : []; |
79 | 80 | |
80 | - try { |
|
81 | + try |
|
82 | + { |
|
81 | 83 | return $routeInfo[1]($request, ...array_values($urlPlaceholders)); |
82 | 84 | } |
83 | 85 | catch (\Exception $e) |