Completed
Push — 4.0 ( 0e3cc0...125a8d )
by Marco
03:38
created
src/Comodojo/Dispatcher/Response/Status.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,9 @@
 block discarded – undo
62 62
 
63 63
     public function description($code=null) {
64 64
 
65
-        if ( is_null($code) ) return $this->codes->getMessage($this->status_code);
65
+        if ( is_null($code) ) {
66
+            return $this->codes->getMessage($this->status_code);
67
+        }
66 68
         
67 69
         return $this->codes->getMessage($code);
68 70
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,9 +60,9 @@
 block discarded – undo
60 60
 
61 61
     }
62 62
 
63
-    public function description($code=null) {
63
+    public function description($code = null) {
64 64
 
65
-        if ( is_null($code) ) return $this->codes->getMessage($this->status_code);
65
+        if (is_null($code)) return $this->codes->getMessage($this->status_code);
66 66
 
67 67
         return $this->codes->getMessage($code);
68 68
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Router/Route.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -201,13 +201,13 @@  discard block
 block discarded – undo
201 201
         // Because of the nature of the global regular expression, all the bits of the matched route are associated with a parameter key
202 202
         foreach ($this->query as $key => $value) {
203 203
 
204
-            if ( isset($path[$key]) ) {
204
+            if (isset($path[$key])) {
205 205
                 /* if it's available a bit associated with the parameter name, it is compared against
206 206
                  * it's regular expression in order to extrect backreferences
207 207
                  */
208
-                if ( preg_match('/^' . $value['regex'] . '$/', $path[$key], $matches) ) {
208
+                if (preg_match('/^'.$value['regex'].'$/', $path[$key], $matches)) {
209 209
 
210
-                    if ( count($matches) == 1 ) $matches = $matches[0]; // This is the case where no backreferences are present or available.
210
+                    if (count($matches) == 1) $matches = $matches[0]; // This is the case where no backreferences are present or available.
211 211
 
212 212
                     // The extracted value (with any backreference available) is added to the query parameters.
213 213
                     $this->setRequestParameter($key, $matches);
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
      */
234 234
     public function serialize() {
235 235
 
236
-        return serialize( (object) [
236
+        return serialize((object)[
237 237
             'classname' => $this->classname,
238 238
             'type' => $this->type,
239 239
             'service' => $this->service,
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -207,7 +207,10 @@
 block discarded – undo
207 207
                  */
208 208
                 if ( preg_match('/^' . $value['regex'] . '$/', $path[$key], $matches) ) {
209 209
 
210
-                    if ( count($matches) == 1 ) $matches = $matches[0]; // This is the case where no backreferences are present or available.
210
+                    if ( count($matches) == 1 ) {
211
+                        $matches = $matches[0];
212
+                    }
213
+                    // This is the case where no backreferences are present or available.
211 214
 
212 215
                     // The extracted value (with any backreference available) is added to the query parameters.
213 216
                     $this->setRequestParameter($key, $matches);
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Service/AbstractService.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     use ResponseTrait;
49 49
     use ExtraTrait;
50 50
 
51
-    protected static $supported_methods = ['GET','PUT','POST','DELETE','OPTIONS','HEAD','TRACE','CONNECT','PURGE'];
51
+    protected static $supported_methods = ['GET', 'PUT', 'POST', 'DELETE', 'OPTIONS', 'HEAD', 'TRACE', 'CONNECT', 'PURGE'];
52 52
 
53 53
     public function __construct(
54 54
         Configuration $configuration,
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
 
82 82
         $supported_methods = $this->getConfiguration()->get('supported-http-methods');
83 83
 
84
-        if ( is_null($supported_methods) ) $supported_methods = self::$supported_methods;
84
+        if (is_null($supported_methods)) $supported_methods = self::$supported_methods;
85 85
 
86
-        if ( method_exists($this, 'any') ) {
86
+        if (method_exists($this, 'any')) {
87 87
 
88 88
             return $supported_methods;
89 89
 
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
 
92 92
         $implemented_methods = [];
93 93
 
94
-        foreach ( $supported_methods as $method ) {
94
+        foreach ($supported_methods as $method) {
95 95
 
96
-            if ( method_exists($this, strtolower($method)) ) array_push($implemented_methods, $method);
96
+            if (method_exists($this, strtolower($method))) array_push($implemented_methods, $method);
97 97
 
98 98
         }
99 99
 
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
 
110 110
         $method = strtolower($method);
111 111
 
112
-        if ( method_exists($this, $method) ) {
112
+        if (method_exists($this, $method)) {
113 113
 
114 114
             return $method;
115 115
 
116
-        } else if ( method_exists($this, 'any') ) {
116
+        } else if (method_exists($this, 'any')) {
117 117
 
118 118
             return 'any';
119 119
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -81,7 +81,9 @@  discard block
 block discarded – undo
81 81
 
82 82
         $supported_methods = $this->getConfiguration()->get('supported-http-methods');
83 83
 
84
-        if ( is_null($supported_methods) ) $supported_methods = self::$supported_methods;
84
+        if ( is_null($supported_methods) ) {
85
+            $supported_methods = self::$supported_methods;
86
+        }
85 87
 
86 88
         if ( method_exists($this, 'any') ) {
87 89
 
@@ -93,7 +95,9 @@  discard block
 block discarded – undo
93 95
 
94 96
         foreach ( $supported_methods as $method ) {
95 97
 
96
-            if ( method_exists($this, strtolower($method)) ) array_push($implemented_methods, $method);
98
+            if ( method_exists($this, strtolower($method)) ) {
99
+                array_push($implemented_methods, $method);
100
+            }
97 101
 
98 102
         }
99 103
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Dispatcher.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -201,8 +201,8 @@
 block discarded – undo
201 201
 
202 202
         $params = $route->getParameter('headers');
203 203
 
204
-        if ( !empty($params) && is_array($params) ) {
205
-            foreach($params as $name => $value) {
204
+        if (!empty($params) && is_array($params)) {
205
+            foreach ($params as $name => $value) {
206 206
                 $this->getResponse()->getHeaders()->set($name, $value);
207 207
             }
208 208
         }
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Cache/ServerCache.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,9 @@
 block discarded – undo
47 47
 
48 48
         $cache_object = $this->getCache()->setNamespace(self::$cache_namespace)->get($name);
49 49
 
50
-        if (is_null($cache_object)) return false;
50
+        if (is_null($cache_object)) {
51
+            return false;
52
+        }
51 53
 
52 54
         $response->import($cache_object);
53 55
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Components/HttpStatusCodes.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -102,7 +102,9 @@
 block discarded – undo
102 102
 
103 103
     public function getMessage($code) {
104 104
 
105
-        if ($this->exists($code)) return $this->codes[$code];
105
+        if ($this->exists($code)) {
106
+            return $this->codes[$code];
107
+        }
106 108
 
107 109
         throw new Exception("Invalid HTTP status code $code");
108 110
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Request/Headers.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,9 @@
 block discarded – undo
41 41
      */
42 42
     private static function getHeaders() {
43 43
 
44
-        if (function_exists('getallheaders')) return getallheaders();
44
+        if (function_exists('getallheaders')) {
45
+            return getallheaders();
46
+        }
45 47
 
46 48
         $headers = array();
47 49
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Router/Table.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -156,7 +156,9 @@  discard block
 block discarded – undo
156 156
 
157 157
     private function readCache() {
158 158
 
159
-        if ($this->configuration->get('routing-table-cache') !== true) return;
159
+        if ($this->configuration->get('routing-table-cache') !== true) {
160
+            return;
161
+        }
160 162
 
161 163
         $data = $this->cache->read();
162 164
 
@@ -176,7 +178,9 @@  discard block
 block discarded – undo
176 178
 
177 179
     private function dumpCache() {
178 180
 
179
-        if ($this->configuration->get('routing-table-cache') !== true) return;
181
+        if ($this->configuration->get('routing-table-cache') !== true) {
182
+            return;
183
+        }
180 184
 
181 185
         $ttl = $this->configuration->get('routing-table-ttl');
182 186
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Router/Model.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -123,7 +123,9 @@
 block discarded – undo
123 123
 
124 124
         if ($this->bypass_routing === false) {
125 125
 
126
-            if (!$this->parse()) throw new DispatcherException("Unable to find a valid route for the specified uri", 0, null, 404);
126
+            if (!$this->parse()) {
127
+                throw new DispatcherException("Unable to find a valid route for the specified uri", 0, null, 404);
128
+            }
127 129
 
128 130
         }
129 131
 
Please login to merge, or discard this patch.