@@ -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 staticPageViewController(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 | if ($this->hasBeenTouched($pageView)) |
@@ -72,7 +73,8 @@ discard block |
||
| 72 | 73 | */ |
| 73 | 74 | private function dynamicPageViewController(DynamicPageView $pageView, Compiler $compiler) |
| 74 | 75 | { |
| 75 | - return function (ServerRequestInterface $request) use ($pageView, $compiler) { |
|
| 76 | + return function (ServerRequestInterface $request) use ($pageView, $compiler) |
|
| 77 | + { |
|
| 76 | 78 | Service::setOption('currentTemplate', $pageView->getAbsoluteFilePath()); |
| 77 | 79 | |
| 78 | 80 | $contentItem = self::getContentItem($pageView, $request->getUri()->getPath()); |
@@ -106,7 +108,8 @@ discard block |
||
| 106 | 108 | */ |
| 107 | 109 | private function repeaterPageViewController(RepeaterPageView $pageView, Compiler $compiler) |
| 108 | 110 | { |
| 109 | - return function (ServerRequestInterface $request) use ($pageView, $compiler) { |
|
| 111 | + return function (ServerRequestInterface $request) use ($pageView, $compiler) |
|
| 112 | + { |
|
| 110 | 113 | Service::setOption('currentTemplate', $pageView->getAbsoluteFilePath()); |
| 111 | 114 | |
| 112 | 115 | $expandedValue = self::getExpandedValue($pageView, $request->getUri()->getPath()); |
@@ -147,7 +150,8 @@ discard block |
||
| 147 | 150 | return $this->repeaterPageViewController($pageView, $compiler); |
| 148 | 151 | |
| 149 | 152 | default: |
| 150 | - return function () { |
|
| 153 | + return function () |
|
| 154 | + { |
|
| 151 | 155 | $errMsg = 'This URL type has not yet been implemented.'; |
| 152 | 156 | |
| 153 | 157 | return new Response(501, ['Content-Type' => 'text/plain'], $errMsg); |
@@ -188,7 +192,8 @@ discard block |
||
| 188 | 192 | { |
| 189 | 193 | self::$baseUrl = $router->getBaseUrl(); |
| 190 | 194 | |
| 191 | - return \FastRoute\simpleDispatcher(function (RouteCollector $r) use ($router, $compiler) { |
|
| 195 | + return \FastRoute\simpleDispatcher(function (RouteCollector $r) use ($router, $compiler) |
|
| 196 | + { |
|
| 192 | 197 | $dispatcher = new RouteDispatcher(); |
| 193 | 198 | |
| 194 | 199 | foreach ($router->getRouteMapping() as $route => $pageView) |
@@ -104,6 +104,9 @@ |
||
| 104 | 104 | 'svg' => 'image/svg+xml', |
| 105 | 105 | ]; |
| 106 | 106 | |
| 107 | + /** |
|
| 108 | + * @return \allejo\stakx\Document\StaticPageView |
|
| 109 | + */ |
|
| 107 | 110 | public static function getMimeType($extension) |
| 108 | 111 | { |
| 109 | 112 | return isset(self::$mimes[$extension]) ? self::$mimes[$extension] : null; |