Completed
Pull Request — master (#75)
by Vladimir
02:18
created
src/allejo/stakx/Server/MimeDetector.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -98,6 +98,9 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/allejo/stakx/Service.php 1 patch
Doc Comments   +10 added lines patch added patch discarded remove patch
@@ -13,11 +13,18 @@  discard block
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/allejo/stakx/Document/DataItem.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -170,7 +170,8 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/allejo/stakx/Server/RouteDispatcher.php 2 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -152,6 +152,9 @@  discard block
 block discarded – undo
152 152
         });
153 153
     }
154 154
 
155
+    /**
156
+     * @param string $url
157
+     */
155 158
     public static function normalizeUrl($url)
156 159
     {
157 160
         return str_replace(self::$baseUrl, '/', $url);
@@ -163,7 +166,7 @@  discard block
 block discarded – undo
163 166
      * @param DynamicPageView $pageView
164 167
      * @param                 $permalink
165 168
      *
166
-     * @return CollectableItem|ReadableDocument|TemplateReadyDocument|null
169
+     * @return CollectableItem|null
167 170
      */
168 171
     private static function getContentItem(DynamicPageView $pageView, $permalink)
169 172
     {
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -37,8 +37,10 @@  discard block
 block discarded – undo
37 37
      */
38 38
     private function staticPageViewController(StaticPageView $pageView, Compiler $compiler)
39 39
     {
40
-        return function () use ($pageView, $compiler) {
41
-            if ($this->hasBeenTouched($pageView)) {
40
+        return function () use ($pageView, $compiler)
41
+        {
42
+            if ($this->hasBeenTouched($pageView))
43
+            {
42 44
                 $pageView->readContent();
43 45
             }
44 46
 
@@ -62,7 +64,8 @@  discard block
 block discarded – undo
62 64
      */
63 65
     private function dynamicPageViewController(DynamicPageView $pageView, Compiler $compiler)
64 66
     {
65
-        return function (ServerRequestInterface $request) use ($pageView, $compiler) {
67
+        return function (ServerRequestInterface $request) use ($pageView, $compiler)
68
+        {
66 69
             $contentItem = self::getContentItem($pageView, self::normalizeUrl($request->getUri()->getPath()));
67 70
 
68 71
             if ($contentItem === null)
@@ -102,7 +105,8 @@  discard block
 block discarded – undo
102 105
                 return $this->dynamicPageViewController($pageView, $compiler);
103 106
 
104 107
             default:
105
-                return function () {
108
+                return function ()
109
+                {
106 110
                     $errMsg = 'This URL type has not yet been implemented.';
107 111
 
108 112
                     return new Response(501, ['Content-Type' => 'text/plain'], $errMsg);
@@ -142,7 +146,8 @@  discard block
 block discarded – undo
142 146
     {
143 147
         self::$baseUrl = $router->getBaseUrl();
144 148
 
145
-        return \FastRoute\simpleDispatcher(function (RouteCollector $r) use ($router, $compiler) {
149
+        return \FastRoute\simpleDispatcher(function (RouteCollector $r) use ($router, $compiler)
150
+        {
146 151
             $dispatcher = new RouteDispatcher();
147 152
 
148 153
             foreach ($router->getRouteMapping() as $route => $pageView)
Please login to merge, or discard this patch.
src/allejo/stakx/Server/DevServer.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,8 @@
 block discarded – undo
43 43
     {
44 44
         $dispatcher = RouteDispatcher::create($router, $compiler);
45 45
 
46
-        return new Server(function (ServerRequestInterface $request) use ($router, $dispatcher) {
46
+        return new Server(function (ServerRequestInterface $request) use ($router, $dispatcher)
47
+        {
47 48
             $httpMethod = $request->getMethod();
48 49
             $urlPath = RouteDispatcher::normalizeUrl($request->getUri()->getPath());
49 50
 
Please login to merge, or discard this patch.