Completed
Push — 4.0 ( 3b08f9...a100dc )
by Marco
14:07
created
src/Comodojo/Dispatcher/Router/Route.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
     public function getServiceName() {
72 72
 
73
-        return (empty($this->service))?"default":implode('.', $this->service);
73
+        return (empty($this->service)) ? "default" : implode('.', $this->service);
74 74
 
75 75
     }
76 76
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 
95 95
         $parameters = $this->parameters;
96 96
 
97
-        return (isset($parameters[$key]))?$parameters[$key]:null;
97
+        return (isset($parameters[$key])) ? $parameters[$key] : null;
98 98
 
99 99
     }
100 100
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 
138 138
         $query = $this->query;
139 139
 
140
-        return isset($query[$key])?$query[$key]["required"]:false;
140
+        return isset($query[$key]) ? $query[$key]["required"] : false;
141 141
 
142 142
     }
143 143
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 
146 146
         $query = $this->query;
147 147
 
148
-        return isset($query[$key])?$query[$key]["regex"]:null;
148
+        return isset($query[$key]) ? $query[$key]["regex"] : null;
149 149
 
150 150
     }
151 151
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
                 /* if it's available a bit associated with the parameter name, it is compared against
187 187
                  * it's regular expression in order to extrect backreferences
188 188
                  */
189
-                if (preg_match('/^' . $value['regex'] . '$/', $path[$key], $matches)) {
189
+                if (preg_match('/^'.$value['regex'].'$/', $path[$key], $matches)) {
190 190
 
191 191
                     if (count($matches) == 1) $matches = $matches[0]; // This is the case where no backreferences are present or available.
192 192
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Router/Table.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
 
122 122
     public function load($routes) {
123 123
 
124
-        if ( !empty($routes) ) {
124
+        if (!empty($routes)) {
125 125
 
126
-            foreach( $routes as $name => $route ) {
126
+            foreach ($routes as $name => $route) {
127 127
 
128 128
                 $this->add($route['route'], $route['type'], $route['class'], $route['parameters']);
129 129
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 
140 140
     private function readCache() {
141 141
 
142
-        if ( $this->configuration->get('routing-table-cache') !== true ) return;
142
+        if ($this->configuration->get('routing-table-cache') !== true) return;
143 143
 
144 144
         $this->routes = $this->cache->setNamespace('dispatcherinternals')->get("dispatcher-routes");
145 145
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 
152 152
     private function dumpCache() {
153 153
 
154
-        if ( $this->configuration->get('routing-table-cache') !== true ) return;
154
+        if ($this->configuration->get('routing-table-cache') !== true) return;
155 155
 
156 156
         $ttl = $this->configuration->get('routing-table-ttl');
157 157
 
@@ -170,14 +170,14 @@  discard block
 block discarded – undo
170 170
             ->setClassName($class) // Class to be invoked
171 171
             ->setParameters($parameters); // Parameters passed via the composer.json configuration (cache, ttl, etc...)
172 172
 
173
-        $this->logger->debug("ROUTE: " . implode("/", $folders));
173
+        $this->logger->debug("ROUTE: ".implode("/", $folders));
174 174
 
175 175
         //$this->logger->debug("PARAMETERS: " . var_export($value, true));
176 176
 
177 177
         // This method generate a global regular expression which will be able to match all the URI supported by the route
178 178
         $regex = $this->parser->read($folders, $route);
179 179
 
180
-        $this->logger->debug("ROUTE: " . $regex);
180
+        $this->logger->debug("ROUTE: ".$regex);
181 181
 
182 182
         //$this->logger->debug("PARAMETERS: " . var_export($value, true));
183 183
 
Please login to merge, or discard this patch.
Braces   +14 added lines, -7 removed lines patch added patch discarded remove patch
@@ -78,10 +78,11 @@  discard block
 block discarded – undo
78 78
 
79 79
         $regex = $this->regex($route);
80 80
 
81
-        if (isset($this->routes[$regex]))
82
-            return $this->routes[$regex];
83
-        else
84
-            return null;
81
+        if (isset($this->routes[$regex])) {
82
+                    return $this->routes[$regex];
83
+        } else {
84
+                    return null;
85
+        }
85 86
 
86 87
     }
87 88
 
@@ -139,11 +140,15 @@  discard block
 block discarded – undo
139 140
 
140 141
     private function readCache() {
141 142
 
142
-        if ( $this->configuration->get('routing-table-cache') !== true ) return;
143
+        if ( $this->configuration->get('routing-table-cache') !== true ) {
144
+            return;
145
+        }
143 146
 
144 147
         $this->routes = $this->cache->setNamespace('dispatcherinternals')->get("dispatcher-routes");
145 148
 
146
-        if (is_null($routes)) return;
149
+        if (is_null($routes)) {
150
+            return;
151
+        }
147 152
 
148 153
         $this->logger->debug("Routing table loaded from cache");
149 154
 
@@ -151,7 +156,9 @@  discard block
 block discarded – undo
151 156
 
152 157
     private function dumpCache() {
153 158
 
154
-        if ( $this->configuration->get('routing-table-cache') !== true ) return;
159
+        if ( $this->configuration->get('routing-table-cache') !== true ) {
160
+            return;
161
+        }
155 162
 
156 163
         $ttl = $this->configuration->get('routing-table-ttl');
157 164
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Components/HttpStatusCodes.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@
 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)) return $this->codes[$code];
106 106
 
107 107
         throw new Exception("Invalid HTTP status code $code");
108 108
 
Please login to merge, or discard this 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.