Completed
Push — 4.0 ( 6a2270...a7534e )
by Marco
12:55
created
src/Comodojo/Dispatcher/Router/Route.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
     public function getServiceName() {
83 83
 
84
-        return (empty($this->service))?"default":implode('.', $this->service);
84
+        return (empty($this->service)) ? "default" : implode('.', $this->service);
85 85
 
86 86
     }
87 87
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 
104 104
     public function getParameter($key) {
105 105
         
106
-        return (isset($this->parameters[$key]))?$this->parameters[$key]:null;
106
+        return (isset($this->parameters[$key])) ? $this->parameters[$key] : null;
107 107
 
108 108
     }
109 109
 
@@ -142,13 +142,13 @@  discard block
 block discarded – undo
142 142
     
143 143
     public function isQueryRequired($key) {
144 144
         
145
-        return isset($this->query[$key])?$this->query[$key]["required"]:false;
145
+        return isset($this->query[$key]) ? $this->query[$key]["required"] : false;
146 146
         
147 147
     }
148 148
     
149 149
     public function getQueryRegex($key) {
150 150
         
151
-        return isset($this->query[$key])?$this->query[$key]["regex"]:null;
151
+        return isset($this->query[$key]) ? $this->query[$key]["regex"] : null;
152 152
         
153 153
     }
154 154
     
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
                 /* if it's available a bit associated with the parameter name, it is compared against
221 221
                  * it's regular expression in order to extrect backreferences
222 222
                  */
223
-                if (preg_match('/^' . $value['regex'] . '$/', $path[$key], $matches)) {
223
+                if (preg_match('/^'.$value['regex'].'$/', $path[$key], $matches)) {
224 224
                     
225 225
                     if (count($matches) == 1) $matches = $matches[0]; // This is the case where no backreferences are present or available.
226 226
                     
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Router/Table.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -150,9 +150,9 @@  discard block
 block discarded – undo
150 150
 
151 151
     public function load($routes) {
152 152
 
153
-        if ( !empty($routes) ) {
153
+        if (!empty($routes)) {
154 154
 
155
-            foreach( $routes as $name => $route ) {
155
+            foreach ($routes as $name => $route) {
156 156
 
157 157
                 $this->add($route['route'], $route['type'], $route['class'], $route['parameters']);
158 158
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
         
191 191
         $routes = array();
192 192
         
193
-        foreach($this->routes as $name => $route) {
193
+        foreach ($this->routes as $name => $route) {
194 194
             
195 195
             $routes[$name] = $route->getData();
196 196
             
@@ -213,14 +213,14 @@  discard block
 block discarded – undo
213 213
             ->setClassName($class) // Class to be invoked
214 214
             ->setParameters($parameters); // Parameters passed via the composer.json configuration (cache, ttl, etc...)
215 215
 
216
-        $this->logger->debug("ROUTE: " . implode("/", $folders));
216
+        $this->logger->debug("ROUTE: ".implode("/", $folders));
217 217
 
218 218
         //$this->logger->debug("PARAMETERS: " . var_export($value, true));
219 219
 
220 220
         // This method generate a global regular expression which will be able to match all the URI supported by the route
221 221
         $regex = $this->parser->read($folders, $route);
222 222
 
223
-        $this->logger->debug("ROUTE: " . $regex);
223
+        $this->logger->debug("ROUTE: ".$regex);
224 224
 
225 225
         //$this->logger->debug("PARAMETERS: " . var_export($value, true));
226 226
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Router/Model.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -92,10 +92,10 @@  discard block
 block discarded – undo
92 92
 
93 93
         $methods = $this->configuration->get('allowed-http-methods');
94 94
 
95
-        if ( ( $methods != null || !empty($methods) ) && in_array($method, $methods) === false ) {
95
+        if (($methods != null || !empty($methods)) && in_array($method, $methods) === false) {
96 96
 
97 97
             throw new DispatcherException("Method not allowed", 0, null, 405, array(
98
-                "Allow" => implode(",",$methods)
98
+                "Allow" => implode(",", $methods)
99 99
             ));
100 100
 
101 101
         }
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 
137 137
             $methods = $service->getImplementedMethods();
138 138
 
139
-            if ( in_array($method, $methods) ) {
139
+            if (in_array($method, $methods)) {
140 140
 
141 141
                 $callable = $service->getMethod($method);
142 142
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
         foreach ($this->table->routes() as $regex => $value) {
180 180
             
181 181
             // The current uri is checked against all the global regular expressions associated with the routes
182
-            if (preg_match("/" . $regex . "/", $path, $matches)) {
182
+            if (preg_match("/".$regex."/", $path, $matches)) {
183 183
 
184 184
                 /* If a route is matched, all the bits of the route string are evalued in order to create
185 185
                  * new query parameters which will be available for the service class
Please login to merge, or discard this patch.