Completed
Push — master ( b5ceee...f69b09 )
by Marco
05:46
created
src/Comodojo/Dispatcher/Components/CommandsLoader.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@
 block discarded – undo
29 29
 
30 30
         $classes = [];
31 31
 
32
-        foreach ($config as $package) {
33
-            foreach ($package as $command) {
34
-                if ( $command['scope'] === 'dispatcher') {
32
+        foreach ( $config as $package ) {
33
+            foreach ( $package as $command ) {
34
+                if ( $command['scope'] === 'dispatcher' ) {
35 35
                     $classes[] = $command['class'];
36 36
                 }
37 37
             }
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Components/Version.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,13 +24,13 @@
 block discarded – undo
24 24
     protected $description = 'Hackable PHP REST framework';
25 25
     protected $version = '4.0-dev';
26 26
     protected $ascii = "\r\n   ___  _               __      __          \r\n".
27
-                       "  / _ \(_)__ ___  ___ _/ /_____/ /  ___ ____\r\n".
28
-                       " / // / (_-</ _ \/ _ `/ __/ __/ _ \/ -_) __/\r\n".
29
-                       "/____/_/___/ .__/\_,_/\__/\__/_//_/\__/_/   \r\n".
30
-                       "          /_/                               \r\n";
27
+                        "  / _ \(_)__ ___  ___ _/ /_____/ /  ___ ____\r\n".
28
+                        " / // / (_-</ _ \/ _ `/ __/ __/ _ \/ -_) __/\r\n".
29
+                        "/____/_/___/ .__/\_,_/\__/\__/_//_/\__/_/   \r\n".
30
+                        "          /_/                               \r\n";
31 31
     protected $template = "\n\n{ascii}\r\n".
32
-                          "---------------------------------------------\r\n".
33
-                          "{name} (ver {version})\r\n{description}\r\n";
32
+                            "---------------------------------------------\r\n".
33
+                            "{name} (ver {version})\r\n{description}\r\n";
34 34
     protected $prefix = 'dispatcher-';
35 35
 
36 36
 }
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Components/PluginsLoader.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@
 block discarded – undo
28 28
 
29 29
         $plain_plugins = [];
30 30
 
31
-        foreach ($config as $package => $plugins) {
32
-            foreach ($plugins as $plugin) {
31
+        foreach ( $config as $package => $plugins ) {
32
+            foreach ( $plugins as $plugin ) {
33 33
                 $plain_plugins[] = $plugin;
34 34
             }
35 35
         }
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Output/Redirect.php 2 patches
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -21,50 +21,50 @@
 block discarded – undo
21 21
  * THE SOFTWARE.
22 22
  */
23 23
 
24
- class Redirect {
24
+    class Redirect {
25 25
 
26
-     public static function compose(
27
-         Request $request,
28
-         Response $response,
29
-         Route $route
30
-     ) {
26
+        public static function compose(
27
+            Request $request,
28
+            Response $response,
29
+            Route $route
30
+        ) {
31 31
 
32
-         $status = $response->getStatus();
33
-         $content = $response->getContent();
34
-         $headers = $response->getHeaders();
32
+            $status = $response->getStatus();
33
+            $content = $response->getContent();
34
+            $headers = $response->getHeaders();
35 35
 
36
-         $code = $route->getRedirectCode();
36
+            $code = $route->getRedirectCode();
37 37
 
38
-         $location = $route->getRedirectLocation();
39
-         $uri = empty($location) ? (string) $request->getUri() : $location;
38
+            $location = $route->getRedirectLocation();
39
+            $uri = empty($location) ? (string) $request->getUri() : $location;
40 40
 
41
-         $message = $route->getRedirectMessage();
41
+            $message = $route->getRedirectMessage();
42 42
 
43
-         if ( $route->getRedirectType() == Route::REDIRECT_REFRESH ) {
43
+            if ( $route->getRedirectType() == Route::REDIRECT_REFRESH ) {
44 44
 
45
-             $output = empty($message) ?
45
+                $output = empty($message) ?
46 46
                  "Please follow <a href=\"$location\">this link</a>"
47 47
                  : $message;
48 48
 
49
-             $status->set(200);
50
-             $headers->set("Refresh", "0;url=$location");
51
-             $content->set($output);
49
+                $status->set(200);
50
+                $headers->set("Refresh", "0;url=$location");
51
+                $content->set($output);
52 52
 
53
-         } else {
53
+            } else {
54 54
 
55
-             if ( !empty($code) ) {
56
-                 $status->set($code);
57
-             } else if ( $request->getVersion() === 'HTTP/1.1' ) {
58
-                 $status->set( (string) $request->getMethod() !== 'GET' ? 303 : 307);
59
-             } else {
60
-                 $status->set(302);
61
-             }
55
+                if ( !empty($code) ) {
56
+                    $status->set($code);
57
+                } else if ( $request->getVersion() === 'HTTP/1.1' ) {
58
+                    $status->set( (string) $request->getMethod() !== 'GET' ? 303 : 307);
59
+                } else {
60
+                    $status->set(302);
61
+                }
62 62
 
63
-             $content->set($message);
64
-             $response->getLocation()->set($uri);
63
+                $content->set($message);
64
+                $response->getLocation()->set($uri);
65 65
 
66
-         }
66
+            }
67 67
 
68
-     }
68
+        }
69 69
 
70
- }
70
+    }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
          $code = $route->getRedirectCode();
37 37
 
38 38
          $location = $route->getRedirectLocation();
39
-         $uri = empty($location) ? (string) $request->getUri() : $location;
39
+         $uri = empty($location) ? (string)$request->getUri() : $location;
40 40
 
41 41
          $message = $route->getRedirectMessage();
42 42
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
              if ( !empty($code) ) {
56 56
                  $status->set($code);
57 57
              } else if ( $request->getVersion() === 'HTTP/1.1' ) {
58
-                 $status->set( (string) $request->getMethod() !== 'GET' ? 303 : 307);
58
+                 $status->set((string)$request->getMethod() !== 'GET' ? 303 : 307);
59 59
              } else {
60 60
                  $status->set(302);
61 61
              }
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Output/Error.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -20,20 +20,20 @@
 block discarded – undo
20 20
  * THE SOFTWARE.
21 21
  */
22 22
 
23
- class Error {
23
+    class Error {
24 24
 
25
-     public static function compose(
26
-         Route $route
27
-     ) {
25
+        public static function compose(
26
+            Route $route
27
+        ) {
28 28
 
29
-         $code = $route->getErrorCode();
30
-         $message = $route->getErrorMessage();
29
+            $code = $route->getErrorCode();
30
+            $message = $route->getErrorMessage();
31 31
 
32
-         $code = empty($code) ? 500 : $code;
33
-         $message = empty($message) ? 'Internal error' : $message;
32
+            $code = empty($code) ? 500 : $code;
33
+            $message = empty($message) ? 'Internal error' : $message;
34 34
 
35
-         throw new DispatcherException($message, 0, null, $code);
35
+            throw new DispatcherException($message, 0, null, $code);
36 36
 
37
-     }
37
+        }
38 38
 
39
- }
39
+    }
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Dispatcher.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         $events->emit(new DispatcherEvent($this));
127 127
 
128 128
         // if dispatcher is administratively disabled, halt the process immediately
129
-        if ($configuration->get('enabled') === false) {
129
+        if ( $configuration->get('enabled') === false ) {
130 130
 
131 131
             $logger->debug("Dispatcher disabled, shutting down gracefully.");
132 132
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 
182 182
         $events->emit($this->createServiceSpecializedEvents('dispatcher.route.#'));
183 183
 
184
-        if ($cache->read($this->request, $this->response)) {
184
+        if ( $cache->read($this->request, $this->response) ) {
185 185
             // we have a cache!
186 186
             // shutdown immediately
187 187
             return $this->shutdown();
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 
190 190
         try {
191 191
 
192
-            switch ($route_type) {
192
+            switch ( $route_type ) {
193 193
 
194 194
                 case 'ROUTE':
195 195
 
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
         $params = $route->getParameter('headers');
242 242
 
243 243
         if ( !empty($params) && is_array($params) ) {
244
-            foreach($params as $name => $value) {
244
+            foreach ( $params as $name => $value ) {
245 245
                 $this->getResponse()->getHeaders()->set($name, $value);
246 246
             }
247 247
         }
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Response/Headers.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 
26 26
     public function send($replace = false) {
27 27
 
28
-        foreach ($this->getAsString() as $header) {
28
+        foreach ( $this->getAsString() as $header ) {
29 29
 
30 30
             header($header, $replace);
31 31
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Traits/HeadersTrait.php 1 patch
Spacing   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
      */
40 40
     public function get($header = null) {
41 41
 
42
-        if (is_null($header)) {
42
+        if ( is_null($header) ) {
43 43
             return $this->headers;
44 44
         }
45 45
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      */
62 62
     public function getAsString($header = null) {
63 63
 
64
-        if (is_null($header)) {
64
+        if ( is_null($header) ) {
65 65
 
66 66
             return array_map([$this, 'headerToString'],
67 67
                 array_keys($this->headers),
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      */
104 104
     public function set($header, $value = null) {
105 105
 
106
-        if (is_null($value)) {
106
+        if ( is_null($value) ) {
107 107
 
108 108
             $header = explode(":", $header, 2);
109 109
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
      */
132 132
     public function delete($header = null) {
133 133
 
134
-        if (is_null($header)) {
134
+        if ( is_null($header) ) {
135 135
 
136 136
             $this->headers = [];
137 137
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
      */
159 159
     public function merge($headers) {
160 160
 
161
-        foreach ($headers as $key => $value) {
161
+        foreach ( $headers as $key => $value ) {
162 162
             $this->set($key, $value);
163 163
         }
164 164
 
@@ -183,8 +183,7 @@  discard block
 block discarded – undo
183 183
     private static function headerToString($header, $value) {
184 184
 
185 185
         return is_array($value) ?
186
-            (string)("$header: ".implode(',',$value)) :
187
-            (string)("$header: $value");
186
+            (string)("$header: ".implode(',', $value)) : (string)("$header: $value");
188 187
 
189 188
     }
190 189
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Cache/ServerCache.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         Response $response
70 70
     ) {
71 71
 
72
-        if ($this->bypass === true) {
72
+        if ( $this->bypass === true ) {
73 73
             return false;
74 74
         }
75 75
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
             ->setNamespace(self::$cache_namespace)
79 79
             ->get($name);
80 80
 
81
-        if (is_null($cache_object)) {
81
+        if ( is_null($cache_object) ) {
82 82
             return false;
83 83
         }
84 84
 
Please login to merge, or discard this patch.