Completed
Push — 4.0 ( ad8a54...ed771a )
by Marco
06:33
created
src/Comodojo/Dispatcher/Router/Model.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -104,7 +104,9 @@
 block discarded – undo
104 104
 
105 105
         if (!$this->bypass) {
106 106
             
107
-            if (!$this->parse()) throw new DispatcherException("Unable to find a valid route for the specified uri", 0, null, 404);
107
+            if (!$this->parse()) {
108
+                throw new DispatcherException("Unable to find a valid route for the specified uri", 0, null, 404);
109
+            }
108 110
 
109 111
         }
110 112
         
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
 
109 109
         $methods = $this->configuration->get('allowed-http-methods');
110 110
 
111
-        if ( ( $methods != null || !empty($methods) ) && in_array($method, $methods) === false ) {
111
+        if (($methods != null || !empty($methods)) && in_array($method, $methods) === false) {
112 112
 
113 113
             throw new DispatcherException("Method not allowed", 0, null, 405, array(
114
-                "Allow" => implode(",",$methods)
114
+                "Allow" => implode(",", $methods)
115 115
             ));
116 116
 
117 117
         }
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
             
139 139
         }
140 140
         
141
-        if ( $this->bypass_service ) {
141
+        if ($this->bypass_service) {
142 142
             
143 143
             return;
144 144
             
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 
159 159
             $methods = $service->getImplementedMethods();
160 160
 
161
-            if ( in_array($method, $methods) ) {
161
+            if (in_array($method, $methods)) {
162 162
 
163 163
                 $callable = $service->getMethod($method);
164 164
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
         foreach ($this->table->routes() as $regex => $value) {
202 202
             
203 203
             // The current uri is checked against all the global regular expressions associated with the routes
204
-            if (preg_match("/" . $regex . "/", $path, $matches)) {
204
+            if (preg_match("/".$regex."/", $path, $matches)) {
205 205
 
206 206
                 /* If a route is matched, all the bits of the route string are evalued in order to create
207 207
                  * new query parameters which will be available for the service class
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Components/CacheManager.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,31 +29,31 @@  discard block
 block discarded – undo
29 29
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
30 30
  */
31 31
 
32
-class CacheManager extends DispatcherClassModel{
32
+class CacheManager extends DispatcherClassModel {
33 33
 
34 34
     public function init() {
35 35
 
36 36
         $cache = $this->configuration()->get('cache');
37 37
 
38
-        if ( empty($cache) ) {
38
+        if (empty($cache)) {
39 39
 
40 40
             $manager = new ComodojoCacheManager(self::getAlgorithm(), $this->logger);
41 41
 
42 42
         } else {
43 43
 
44
-            $enabled = ( empty($cache['enabled']) || $cache['enabled'] === true ) ? true : false;
44
+            $enabled = (empty($cache['enabled']) || $cache['enabled'] === true) ? true : false;
45 45
 
46
-            $algorithm = self::getAlgorithm( empty($cache['algorithm']) ? null : $cache['algorithm']);
46
+            $algorithm = self::getAlgorithm(empty($cache['algorithm']) ? null : $cache['algorithm']);
47 47
 
48 48
             $manager = new ComodojoCacheManager($algorithm, $this->logger);
49 49
 
50
-            if ( $enabled && !empty($cache['providers']) ) {
50
+            if ($enabled && !empty($cache['providers'])) {
51 51
 
52 52
                 foreach ($cache['providers'] as $provider => $parameters) {
53 53
 
54 54
                     $handler = $this->getHandler($provider, $parameters);
55 55
 
56
-                    if ( $handler instanceof CacheInterface ) $manager->addProvider($handler);
56
+                    if ($handler instanceof CacheInterface) $manager->addProvider($handler);
57 57
 
58 58
                 }
59 59
 
@@ -80,13 +80,13 @@  discard block
 block discarded – undo
80 80
 
81 81
     protected function getHandler($provider, $parameters) {
82 82
 
83
-        switch ( strtolower($parameters['type']) ) {
83
+        switch (strtolower($parameters['type'])) {
84 84
 
85 85
             case 'filecache':
86 86
 
87 87
                 $base = $this->configuration->get('base-path');
88 88
 
89
-                if ( empty($parameters['folder']) ||  empty($base) ) {
89
+                if (empty($parameters['folder']) || empty($base)) {
90 90
                     $this->logger->warning("Wrong cache provider, disabling $provider", $parameters);
91 91
                     break;
92 92
                 }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 
100 100
             case 'memcached':
101 101
 
102
-                if ( empty($parameters['host']) ) {
102
+                if (empty($parameters['host'])) {
103 103
                     $this->logger->warning("Wrong cache provider, disabling $provider", $parameters);
104 104
                     break;
105 105
                 }
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
      */
133 133
     protected static function getAlgorithm($algorithm = null) {
134 134
 
135
-        switch ( strtoupper($algorithm) ) {
135
+        switch (strtoupper($algorithm)) {
136 136
 
137 137
             case 'PICK_LAST':
138 138
                 $selected = ComodojoCacheManager::PICK_LAST;
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,9 @@
 block discarded – undo
64 64
 
65 65
                     $handler = $this->getHandler($provider, $parameters);
66 66
 
67
-                    if ( $handler instanceof CacheInterface ) $manager->addProvider($handler);
67
+                    if ( $handler instanceof CacheInterface ) {
68
+                        $manager->addProvider($handler);
69
+                    }
68 70
 
69 71
                 }
70 72
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Components/EventsManager.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
         $callable = $this->convertToListener($class, $event);
49 49
 
50
-        if ( $callable === false ) return null;
50
+        if ($callable === false) return null;
51 51
 
52 52
         return $this->addListener($event, $callable, $priority);
53 53
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
         $callable = $this->convertToListener($class, $event);
59 59
 
60
-        if ( $callable === false ) return null;
60
+        if ($callable === false) return null;
61 61
 
62 62
         return $this->addOneTimeListener($event, $callable, $priority);
63 63
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 
66 66
     protected function convertToListener($class, $event) {
67 67
 
68
-        if ( !class_exists($class) ) {
68
+        if (!class_exists($class)) {
69 69
 
70 70
             $this->logger->error("Cannot subscribe class $class to event $event: cannot find class");
71 71
 
@@ -91,11 +91,11 @@  discard block
 block discarded – undo
91 91
 
92 92
     public function load($plugins) {
93 93
 
94
-        if ( !empty($plugins) ) {
94
+        if (!empty($plugins)) {
95 95
 
96
-            foreach( $plugins as $name => $plugin ) {
96
+            foreach ($plugins as $name => $plugin) {
97 97
 
98
-                if ( !isset($plugin['class']) || !isset($plugin["event"]) ) {
98
+                if (!isset($plugin['class']) || !isset($plugin["event"])) {
99 99
 
100 100
                     $this->logger->error("Invalid plugin definition", $plugin);
101 101
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
                 $priority = isset($plugin['priority']) ? $plugin['priority'] : 0;
107 107
                 $onetime = isset($plugin['onetime']) ? $plugin['onetime'] : 0;
108 108
 
109
-                if ( $onetime ) $this->subscribeOnce($plugin['event'], $plugin['class'], $priority);
109
+                if ($onetime) $this->subscribeOnce($plugin['event'], $plugin['class'], $priority);
110 110
                 else $this->subscribe($plugin['event'], $plugin['class'], $priority);
111 111
 
112 112
             }
Please login to merge, or discard this patch.
Braces   +11 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,7 +47,9 @@  discard block
 block discarded – undo
47 47
 
48 48
         $callable = $this->convertToListener($class, $event);
49 49
 
50
-        if ( $callable === false ) return null;
50
+        if ( $callable === false ) {
51
+            return null;
52
+        }
51 53
 
52 54
         return $this->addListener($event, $callable, $priority);
53 55
 
@@ -57,7 +59,9 @@  discard block
 block discarded – undo
57 59
 
58 60
         $callable = $this->convertToListener($class, $event);
59 61
 
60
-        if ( $callable === false ) return null;
62
+        if ( $callable === false ) {
63
+            return null;
64
+        }
61 65
 
62 66
         return $this->addOneTimeListener($event, $callable, $priority);
63 67
 
@@ -106,8 +110,11 @@  discard block
 block discarded – undo
106 110
                 $priority = isset($plugin['priority']) ? $plugin['priority'] : 0;
107 111
                 $onetime = isset($plugin['onetime']) ? $plugin['onetime'] : 0;
108 112
 
109
-                if ( $onetime ) $this->subscribeOnce($plugin['event'], $plugin['class'], $priority);
110
-                else $this->subscribe($plugin['event'], $plugin['class'], $priority);
113
+                if ( $onetime ) {
114
+                    $this->subscribeOnce($plugin['event'], $plugin['class'], $priority);
115
+                } else {
116
+                    $this->subscribe($plugin['event'], $plugin['class'], $priority);
117
+                }
111 118
 
112 119
             }
113 120
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Dispatcher.php 3 patches
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -251,6 +251,9 @@  discard block
 block discarded – undo
251 251
         
252 252
     }
253 253
     
254
+    /**
255
+     * @param Router\Route $route
256
+     */
254 257
     private function dumpCache($route) {
255 258
         
256 259
         $cache = strtoupper($route->getParameter('cache'));
@@ -281,6 +284,9 @@  discard block
 block discarded – undo
281 284
        
282 285
     }
283 286
     
287
+    /**
288
+     * @param Router\Route $route
289
+     */
284 290
     private function processConfigurationParameters($route) {
285 291
         
286 292
         $params = $route->getParameter('headers');
@@ -292,6 +298,9 @@  discard block
 block discarded – undo
292 298
         
293 299
     }
294 300
 
301
+    /**
302
+     * @param string $name
303
+     */
295 304
     private function emitServiceSpecializedEvents($name) {
296 305
 
297 306
         $this->logger()->debug("Emitting $name service-event.");
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         $this->setTimestamp();
77 77
 
78 78
         // parsing configuration
79
-        $this->configuration = new Configuration( DefaultConfiguration::get() );
79
+        $this->configuration = new Configuration(DefaultConfiguration::get());
80 80
 
81 81
         $this->configuration()->merge($configuration);
82 82
 
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
 
156 156
         $this->logger()->debug("Emitting global dispatcher event.");
157 157
 
158
-        $this->events()->emit( new DispatcherEvent($this) );
158
+        $this->events()->emit(new DispatcherEvent($this));
159 159
 
160
-        if ( $this->configuration()->get('enabled') === false ) {
160
+        if ($this->configuration()->get('enabled') === false) {
161 161
 
162 162
             $this->logger()->debug("Dispatcher disabled, shutting down gracefully.");
163 163
 
@@ -173,13 +173,13 @@  discard block
 block discarded – undo
173 173
 
174 174
         }
175 175
 
176
-        $this->events()->emit( $this->emitServiceSpecializedEvents('dispatcher.request') );
176
+        $this->events()->emit($this->emitServiceSpecializedEvents('dispatcher.request'));
177 177
 
178
-        $this->events()->emit( $this->emitServiceSpecializedEvents('dispatcher.request.'.$this->request()->method()->get()) );
178
+        $this->events()->emit($this->emitServiceSpecializedEvents('dispatcher.request.'.$this->request()->method()->get()));
179 179
 
180
-        $this->events()->emit( $this->emitServiceSpecializedEvents('dispatcher.request.#') );
180
+        $this->events()->emit($this->emitServiceSpecializedEvents('dispatcher.request.#'));
181 181
 
182
-        if ( $this->readCache() ) {
182
+        if ($this->readCache()) {
183 183
 
184 184
             return $this->shutdown();
185 185
 
@@ -209,13 +209,13 @@  discard block
 block discarded – undo
209 209
 
210 210
         $this->logger()->debug("Route acquired, type $route_type directed to $route_service.");
211 211
 
212
-        $this->events()->emit( $this->emitServiceSpecializedEvents('dispatcher.route') );
212
+        $this->events()->emit($this->emitServiceSpecializedEvents('dispatcher.route'));
213 213
 
214
-        $this->events()->emit( $this->emitServiceSpecializedEvents('dispatcher.route.'.$route_type) );
214
+        $this->events()->emit($this->emitServiceSpecializedEvents('dispatcher.route.'.$route_type));
215 215
 
216
-        $this->events()->emit( $this->emitServiceSpecializedEvents('dispatcher.route.'.$route_service) );
216
+        $this->events()->emit($this->emitServiceSpecializedEvents('dispatcher.route.'.$route_service));
217 217
 
218
-        $this->events()->emit( $this->emitServiceSpecializedEvents('dispatcher.route.#') );
218
+        $this->events()->emit($this->emitServiceSpecializedEvents('dispatcher.route.#'));
219 219
 
220 220
         // translate route to service
221 221
 
@@ -243,11 +243,11 @@  discard block
 block discarded – undo
243 243
 
244 244
     private function readCache() {
245 245
 
246
-        $name = (string) $this->request()->uri();
246
+        $name = (string)$this->request()->uri();
247 247
 
248 248
         $cache = $this->cache()->setNamespace('dispatcherservice')->get($name);
249 249
 
250
-        if ( is_null($cache) ) return false;
250
+        if (is_null($cache)) return false;
251 251
 
252 252
         $this->response = $cache;
253 253
 
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 
260 260
         $cache = strtoupper($route->getParameter('cache'));
261 261
         $ttl = $route->getParameter('ttl');
262
-        $name = (string) $this->request()->uri();
262
+        $name = (string)$this->request()->uri();
263 263
         $method = $this->request()->method()->get();
264 264
         $status = $this->response()->status()->get();
265 265
 
@@ -267,10 +267,10 @@  discard block
 block discarded – undo
267 267
         //        because of dispatcher internal structure: if post request is cached
268 268
         //        subsequent requests will never reach the service.
269 269
         if (
270
-            ( $cache == 'SERVER' || $cache == 'BOTH' ) &&
270
+            ($cache == 'SERVER' || $cache == 'BOTH') &&
271 271
             in_array($request->method()->get(), array('GET', 'HEAD')) &&
272 272
             in_array($this->status()->get(), array(200, 203, 300, 301, 302, 404, 410))
273
-        ){
273
+        ) {
274 274
 
275 275
             $this->cache()->setNamespace('dispatcherservice')->set($name, $this->response(), $ttl);
276 276
 
@@ -282,9 +282,9 @@  discard block
 block discarded – undo
282 282
 
283 283
         $params = $route->getParameter('headers');
284 284
 
285
-        if ( !empty($params) && is_array($params) ) {
285
+        if (!empty($params) && is_array($params)) {
286 286
 
287
-            foreach($params as $name=>$value) $this->response()->headers()->set($name, $value);
287
+            foreach ($params as $name=>$value) $this->response()->headers()->set($name, $value);
288 288
         }
289 289
 
290 290
     }
@@ -324,11 +324,11 @@  discard block
 block discarded – undo
324 324
 
325 325
         $this->response()->consolidate($this->request, $this->route);
326 326
 
327
-        $this->events()->emit( $this->emitServiceSpecializedEvents('dispatcher.response') );
327
+        $this->events()->emit($this->emitServiceSpecializedEvents('dispatcher.response'));
328 328
 
329
-        $this->events()->emit( $this->emitServiceSpecializedEvents('dispatcher.response.'.$this->response()->status()->get()) );
329
+        $this->events()->emit($this->emitServiceSpecializedEvents('dispatcher.response.'.$this->response()->status()->get()));
330 330
 
331
-        $this->events()->emit( $this->emitServiceSpecializedEvents('dispatcher.response.#') );
331
+        $this->events()->emit($this->emitServiceSpecializedEvents('dispatcher.response.#'));
332 332
 
333 333
         $this->logger()->debug("Composing return value.");
334 334
 
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 
337 337
         $this->logger()->debug("Dispatcher run-cycle ends.");
338 338
 
339
-        if ( function_exists('fastcgi_finish_request') ) fastcgi_finish_request();
339
+        if (function_exists('fastcgi_finish_request')) fastcgi_finish_request();
340 340
         else ob_end_clean();
341 341
 
342 342
         return $return;
Please login to merge, or discard this patch.
Braces   +11 added lines, -4 removed lines patch added patch discarded remove patch
@@ -247,7 +247,9 @@  discard block
 block discarded – undo
247 247
 
248 248
         $cache = $this->cache()->setNamespace('dispatcherservice')->get($name);
249 249
 
250
-        if ( is_null($cache) ) return false;
250
+        if ( is_null($cache) ) {
251
+            return false;
252
+        }
251 253
 
252 254
         $this->response = $cache;
253 255
 
@@ -284,7 +286,9 @@  discard block
 block discarded – undo
284 286
 
285 287
         if ( !empty($params) && is_array($params) ) {
286 288
 
287
-            foreach($params as $name=>$value) $this->response()->headers()->set($name, $value);
289
+            foreach($params as $name=>$value) {
290
+                $this->response()->headers()->set($name, $value);
291
+            }
288 292
         }
289 293
 
290 294
     }
@@ -336,8 +340,11 @@  discard block
 block discarded – undo
336 340
 
337 341
         $this->logger()->debug("Dispatcher run-cycle ends.");
338 342
 
339
-        if ( function_exists('fastcgi_finish_request') ) fastcgi_finish_request();
340
-        else ob_end_clean();
343
+        if ( function_exists('fastcgi_finish_request') ) {
344
+            fastcgi_finish_request();
345
+        } else {
346
+            ob_end_clean();
347
+        }
341 348
 
342 349
         return $return;
343 350
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Router/Table.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -139,9 +139,9 @@  discard block
 block discarded – undo
139 139
 
140 140
     public function load($routes) {
141 141
 
142
-        if ( !empty($routes) ) {
142
+        if (!empty($routes)) {
143 143
 
144
-            foreach( $routes as $name => $route ) {
144
+            foreach ($routes as $name => $route) {
145 145
 
146 146
                 $this->add($route['route'], $route['type'], $route['class'], $route['parameters']);
147 147
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
     
158 158
     private function readCache() {
159 159
         
160
-        if ( $this->configuration()->get('routing-table-cache') !== true ) return;
160
+        if ($this->configuration()->get('routing-table-cache') !== true) return;
161 161
         
162 162
         $routes = $this->cache->setNamespace('dispatcher-internals')->get("dispatcher-routes");
163 163
         
@@ -177,13 +177,13 @@  discard block
 block discarded – undo
177 177
     
178 178
     private function dumpCache() {
179 179
         
180
-        if ( $this->configuration()->get('routing-table-cache') !== true ) return;
180
+        if ($this->configuration()->get('routing-table-cache') !== true) return;
181 181
         
182 182
         $ttl = $this->configuration()->get('routing-table-ttl');
183 183
         
184 184
         $routes = array();
185 185
         
186
-        foreach($this->routes as $name => $route) {
186
+        foreach ($this->routes as $name => $route) {
187 187
             
188 188
             $routes[$name] = $route->getData();
189 189
             
@@ -204,14 +204,14 @@  discard block
 block discarded – undo
204 204
             ->setClassName($class) // Class to be invoked
205 205
             ->setParameters($parameters); // Parameters passed via the composer.json configuration (cache, ttl, etc...)
206 206
 
207
-        $this->logger->debug("ROUTE: " . implode("/", $folders));
207
+        $this->logger->debug("ROUTE: ".implode("/", $folders));
208 208
 
209 209
         //$this->logger->debug("PARAMETERS: " . var_export($value, true));
210 210
 
211 211
         // This method generate a global regular expression which will be able to match all the URI supported by the route
212 212
         $regex = $this->parser->read($folders, $route);
213 213
 
214
-        $this->logger->debug("ROUTE: " . $regex);
214
+        $this->logger->debug("ROUTE: ".$regex);
215 215
 
216 216
         //$this->logger->debug("PARAMETERS: " . var_export($value, true));
217 217
 
Please login to merge, or discard this patch.
Braces   +14 added lines, -7 removed lines patch added patch discarded remove patch
@@ -84,10 +84,11 @@  discard block
 block discarded – undo
84 84
 
85 85
         $regex = $this->regex($route);
86 86
 
87
-        if (isset($this->routes[$regex]))
88
-            return $this->routes[$regex];
89
-        else
90
-            return null;
87
+        if (isset($this->routes[$regex])) {
88
+                    return $this->routes[$regex];
89
+        } else {
90
+                    return null;
91
+        }
91 92
 
92 93
     }
93 94
 
@@ -157,11 +158,15 @@  discard block
 block discarded – undo
157 158
     
158 159
     private function readCache() {
159 160
         
160
-        if ( $this->configuration()->get('routing-table-cache') !== true ) return;
161
+        if ( $this->configuration()->get('routing-table-cache') !== true ) {
162
+            return;
163
+        }
161 164
         
162 165
         $routes = $this->cache->setNamespace('dispatcher-internals')->get("dispatcher-routes");
163 166
         
164
-        if (is_null($routes)) return;
167
+        if (is_null($routes)) {
168
+            return;
169
+        }
165 170
         
166 171
         foreach ($routes as $name => $data) {
167 172
             
@@ -177,7 +182,9 @@  discard block
 block discarded – undo
177 182
     
178 183
     private function dumpCache() {
179 184
         
180
-        if ( $this->configuration()->get('routing-table-cache') !== true ) return;
185
+        if ( $this->configuration()->get('routing-table-cache') !== true ) {
186
+            return;
187
+        }
181 188
         
182 189
         $ttl = $this->configuration()->get('routing-table-ttl');
183 190
         
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Components/LogManager.php 2 patches
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -65,7 +65,9 @@  discard block
 block discarded – undo
65 65
 
66 66
                 $handler = $this->getHandler($provider, $parameters);
67 67
 
68
-                if ( $handler instanceof HandlerInterface ) $logger->pushHandler($handler);
68
+                if ( $handler instanceof HandlerInterface ) {
69
+                    $logger->pushHandler($handler);
70
+                }
69 71
 
70 72
             }
71 73
 
@@ -112,7 +114,9 @@  discard block
 block discarded – undo
112 114
                 
113 115
             case 'SyslogHandler':
114 116
                 
115
-                if ( empty($parameters['ident']) ) return null;
117
+                if ( empty($parameters['ident']) ) {
118
+                    return null;
119
+                }
116 120
                 
117 121
                 $facility = empty($parameters['facility']) ? LOG_USER : $parameters['facility'];
118 122
             
@@ -211,7 +215,9 @@  discard block
 block discarded – undo
211 215
     
212 216
     protected static function getFilePermission($filepermission = null) {
213 217
         
214
-        if ( is_null($filepermission) ) return null;
218
+        if ( is_null($filepermission) ) {
219
+            return null;
220
+        }
215 221
         
216 222
         return filter_var($bubble, FILTER_VALIDATE_INT, array(
217 223
             'options' => array(
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
47 47
 
48 48
         if (
49 49
             empty($log) ||
50
-            ( isset($log['enabled']) && $log['enabled'] === false ) ||
50
+            (isset($log['enabled']) && $log['enabled'] === false) ||
51 51
             empty($log['providers'])
52 52
         ) {
53 53
 
54 54
             $logger = new Logger('dispatcher');
55 55
 
56
-            $logger->pushHandler( new NullHandler( self::getLevel() ) );
56
+            $logger->pushHandler(new NullHandler(self::getLevel()));
57 57
 
58 58
         } else {
59 59
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 
66 66
                 $handler = $this->getHandler($provider, $parameters);
67 67
 
68
-                if ( $handler instanceof HandlerInterface ) $logger->pushHandler($handler);
68
+                if ($handler instanceof HandlerInterface) $logger->pushHandler($handler);
69 69
 
70 70
             }
71 71
 
@@ -92,19 +92,19 @@  discard block
 block discarded – undo
92 92
 
93 93
     protected function getHandler($provider, $parameters) {
94 94
 
95
-        switch ( $parameters['type'] ) {
95
+        switch ($parameters['type']) {
96 96
 
97 97
             case 'StreamHandler':
98 98
 
99 99
                 $stream = $this->configuration->get('base-path').'/'.(empty($parameters['stream']) ? 'dispatcher.log' : $parameters['stream']);
100 100
 
101
-                $level = self::getLevel( empty($parameters['level']) ? null : $parameters['level'] );
101
+                $level = self::getLevel(empty($parameters['level']) ? null : $parameters['level']);
102 102
 
103
-                $bubble = self::getBubble( empty($parameters['bubble']) ? true : $parameters['bubble'] );
103
+                $bubble = self::getBubble(empty($parameters['bubble']) ? true : $parameters['bubble']);
104 104
 
105
-                $filePermission = self::getFilePermission( empty($parameters['filePermission']) ? null : $parameters['filePermission'] );
105
+                $filePermission = self::getFilePermission(empty($parameters['filePermission']) ? null : $parameters['filePermission']);
106 106
 
107
-                $useLocking = self::getLocking( empty($parameters['useLocking']) ? false : $parameters['useLocking'] );
107
+                $useLocking = self::getLocking(empty($parameters['useLocking']) ? false : $parameters['useLocking']);
108 108
 
109 109
                 $handler = new StreamHandler($stream, $level, $bubble, $filePermission, $useLocking);
110 110
 
@@ -112,13 +112,13 @@  discard block
 block discarded – undo
112 112
 
113 113
             case 'SyslogHandler':
114 114
 
115
-                if ( empty($parameters['ident']) ) return null;
115
+                if (empty($parameters['ident'])) return null;
116 116
 
117 117
                 $facility = empty($parameters['facility']) ? LOG_USER : $parameters['facility'];
118 118
 
119
-                $level = self::getLevel( empty($parameters['level']) ? null : $parameters['level'] );
119
+                $level = self::getLevel(empty($parameters['level']) ? null : $parameters['level']);
120 120
 
121
-                $bubble = self::getBubble( empty($parameters['bubble']) ? true : $parameters['bubble'] );
121
+                $bubble = self::getBubble(empty($parameters['bubble']) ? true : $parameters['bubble']);
122 122
 
123 123
                 $logopts = empty($parameters['logopts']) ? LOG_PID : $parameters['logopts'];
124 124
 
@@ -130,11 +130,11 @@  discard block
 block discarded – undo
130 130
 
131 131
                 $messageType = empty($parameters['messageType']) ? ErrorLogHandler::OPERATING_SYSTEM : $parameters['messageType'];
132 132
 
133
-                $level = self::getLevel( empty($parameters['level']) ? null : $parameters['level'] );
133
+                $level = self::getLevel(empty($parameters['level']) ? null : $parameters['level']);
134 134
 
135
-                $bubble = self::getBubble( empty($parameters['bubble']) ? true : $parameters['bubble'] );
135
+                $bubble = self::getBubble(empty($parameters['bubble']) ? true : $parameters['bubble']);
136 136
 
137
-                $expandNewlines = self::getExpandNewlines( empty($parameters['expandNewlines']) ? false : $parameters['expandNewlines'] );
137
+                $expandNewlines = self::getExpandNewlines(empty($parameters['expandNewlines']) ? false : $parameters['expandNewlines']);
138 138
 
139 139
                 $handler = new ErrorLogHandler($messageType, $level, $bubble, $expandNewlines);
140 140
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
      */
159 159
     protected static function getLevel($level = null) {
160 160
 
161
-        switch ( strtoupper($level) ) {
161
+        switch (strtoupper($level)) {
162 162
 
163 163
             case 'INFO':
164 164
                 $logger_level = Logger::INFO;
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 
212 212
     protected static function getFilePermission($filepermission = null) {
213 213
 
214
-        if ( is_null($filepermission) ) return null;
214
+        if (is_null($filepermission)) return null;
215 215
 
216 216
         return filter_var($filepermission, FILTER_VALIDATE_INT, array(
217 217
             'options' => array(
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Components/DefaultConfiguration.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,11 +48,11 @@
 block discarded – undo
48 48
 
49 49
     private static function urlGetAbsolute() {
50 50
 
51
-        $http = 'http' . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 's' : '') . '://';
51
+        $http = 'http'.((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 's' : '').'://';
52 52
 
53 53
         $uri = self::uriGetAbsolute();
54 54
 
55
-        return ( $http . (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost') . $uri . "/" );
55
+        return ($http.(isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost').$uri."/");
56 56
 
57 57
     }
58 58
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Response/Preprocessor/Status201.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
 
31 31
         $location = $this->response()->location()->get();
32 32
 
33
-        if ( $location != null ) $this->response()->headers()->set("Location: ".$location);
33
+        if ($location != null) $this->response()->headers()->set("Location: ".$location);
34 34
 
35 35
         parent::consolidate();
36 36
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,9 @@
 block discarded – undo
30 30
 
31 31
         $location = $this->response()->location()->get();
32 32
 
33
-        if ( $location != null ) $this->response()->headers()->set("Location: ".$location);
33
+        if ( $location != null ) {
34
+            $this->response()->headers()->set("Location: ".$location);
35
+        }
34 36
 
35 37
         parent::consolidate();
36 38
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Response/Preprocessor/Status301.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@
 block discarded – undo
32 32
 
33 33
         $location = $this->response()->location()->get();
34 34
 
35
-        if ( empty($location) ) throw new Exception("Invalid location, cannot redirect");
35
+        if (empty($location)) throw new Exception("Invalid location, cannot redirect");
36 36
 
37 37
         $this->response()->headers()->set("Location: ".$location);
38 38
 
39
-        if ( empty($this->response->content()->get()) ) {
39
+        if (empty($this->response->content()->get())) {
40 40
 
41 41
             $this->response->content()->set(sprintf('<!DOCTYPE html>
42 42
 <html>
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,9 @@
 block discarded – undo
32 32
 
33 33
         $location = $this->response()->location()->get();
34 34
 
35
-        if ( empty($location) ) throw new Exception("Invalid location, cannot redirect");
35
+        if ( empty($location) ) {
36
+            throw new Exception("Invalid location, cannot redirect");
37
+        }
36 38
 
37 39
         $this->response()->headers()->set("Location: ".$location);
38 40
 
Please login to merge, or discard this patch.