@@ -88,9 +88,9 @@ |
||
| 88 | 88 | * Find a ContentItem from a Dynamic PageView or null if it doesn't exist. |
| 89 | 89 | * |
| 90 | 90 | * @param DynamicPageView $pageView |
| 91 | - * @param $permalink |
|
| 91 | + * @param string $permalink |
|
| 92 | 92 | * |
| 93 | - * @return CollectableItem|ReadableDocument|TemplateReadyDocument|null |
|
| 93 | + * @return CollectableItem|null |
|
| 94 | 94 | */ |
| 95 | 95 | private static function getContentItem(DynamicPageView $pageView, $permalink) |
| 96 | 96 | { |
@@ -34,7 +34,8 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | private function staticPageViewController(StaticPageView $pageView, Compiler $compiler) |
| 36 | 36 | { |
| 37 | - return function () use ($pageView, $compiler) { |
|
| 37 | + return function () use ($pageView, $compiler) |
|
| 38 | + { |
|
| 38 | 39 | $pageView->readContent(); |
| 39 | 40 | $mimeType = MimeDetector::getMimeType(fs::getExtension($pageView->getTargetFile())); |
| 40 | 41 | |
@@ -56,7 +57,8 @@ discard block |
||
| 56 | 57 | */ |
| 57 | 58 | private function dynamicPageViewController(DynamicPageView $pageView, Compiler $compiler) |
| 58 | 59 | { |
| 59 | - return function (ServerRequestInterface $request) use ($pageView, $compiler) { |
|
| 60 | + return function (ServerRequestInterface $request) use ($pageView, $compiler) |
|
| 61 | + { |
|
| 60 | 62 | $contentItem = self::getContentItem($pageView, $request->getUri()->getPath()); |
| 61 | 63 | |
| 62 | 64 | if ($contentItem === null) |
@@ -90,7 +92,8 @@ discard block |
||
| 90 | 92 | return $this->dynamicPageViewController($pageView, $compiler); |
| 91 | 93 | |
| 92 | 94 | default: |
| 93 | - return function () { |
|
| 95 | + return function () |
|
| 96 | + { |
|
| 94 | 97 | $errMsg = 'This URL type has not yet been implemented.'; |
| 95 | 98 | |
| 96 | 99 | return new Response(501, ['Content-Type' => 'text/plain'], $errMsg); |
@@ -108,7 +111,8 @@ discard block |
||
| 108 | 111 | */ |
| 109 | 112 | public static function create(PageViewRouter $router, Compiler $compiler) |
| 110 | 113 | { |
| 111 | - return \FastRoute\simpleDispatcher(function (RouteCollector $r) use ($router, $compiler) { |
|
| 114 | + return \FastRoute\simpleDispatcher(function (RouteCollector $r) use ($router, $compiler) |
|
| 115 | + { |
|
| 112 | 116 | $dispatcher = new RouteDispatcher(); |
| 113 | 117 | |
| 114 | 118 | foreach ($router->getRouteMapping() as $route => $pageView) |
@@ -13,6 +13,9 @@ |
||
| 13 | 13 | |
| 14 | 14 | class DevServer |
| 15 | 15 | { |
| 16 | + /** |
|
| 17 | + * @param string $url |
|
| 18 | + */ |
|
| 16 | 19 | private static function searchAsset($url, $continueNesting = true) |
| 17 | 20 | { |
| 18 | 21 | $preparedPath = substr($url, 0, 1) === '/' ? substr($url, 1) : $url; |
@@ -43,7 +43,8 @@ |
||
| 43 | 43 | { |
| 44 | 44 | $dispatcher = RouteDispatcher::create($router, $compiler); |
| 45 | 45 | |
| 46 | - return new Server(function (ServerRequestInterface $request) use ($dispatcher) { |
|
| 46 | + return new Server(function (ServerRequestInterface $request) use ($dispatcher) |
|
| 47 | + { |
|
| 47 | 48 | $httpMethod = $request->getMethod(); |
| 48 | 49 | $urlPath = $request->getUri()->getPath(); |
| 49 | 50 | |
@@ -98,6 +98,9 @@ |
||
| 98 | 98 | 'json' => 'application/json' |
| 99 | 99 | ]; |
| 100 | 100 | |
| 101 | + /** |
|
| 102 | + * @return \allejo\stakx\Document\StaticPageView |
|
| 103 | + */ |
|
| 101 | 104 | public static function getMimeType($extension) |
| 102 | 105 | { |
| 103 | 106 | return isset(self::$mimes[$extension]) ? self::$mimes[$extension] : null; |
@@ -13,11 +13,18 @@ discard block |
||
| 13 | 13 | protected static $runTimeStatus; |
| 14 | 14 | protected static $options; |
| 15 | 15 | |
| 16 | + /** |
|
| 17 | + * @param string $key |
|
| 18 | + * @param string $value |
|
| 19 | + */ |
|
| 16 | 20 | public static function setOption($key, $value) |
| 17 | 21 | { |
| 18 | 22 | self::$options[$key] = $value; |
| 19 | 23 | } |
| 20 | 24 | |
| 25 | + /** |
|
| 26 | + * @param string $key |
|
| 27 | + */ |
|
| 21 | 28 | public static function getOption($key) |
| 22 | 29 | { |
| 23 | 30 | return isset(self::$options[$key]) ? self::$options[$key] : null; |
@@ -48,6 +55,9 @@ discard block |
||
| 48 | 55 | return self::$workingDirectory; |
| 49 | 56 | } |
| 50 | 57 | |
| 58 | + /** |
|
| 59 | + * @param \string|null $directory |
|
| 60 | + */ |
|
| 51 | 61 | public static function setWorkingDirectory($directory) |
| 52 | 62 | { |
| 53 | 63 | self::$workingDirectory = $directory; |
@@ -170,7 +170,8 @@ |
||
| 170 | 170 | return call_user_func_array([$this, $fxnCall], []); |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - if (isset($this->data[$offset])) { |
|
| 173 | + if (isset($this->data[$offset])) |
|
| 174 | + { |
|
| 174 | 175 | return $this->data[$offset]; |
| 175 | 176 | } |
| 176 | 177 | |