Completed
Push — 4.0 ( cafdfc...affd8b )
by Marco
02:49
created
src/Comodojo/Dispatcher/Request/Headers.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,13 +41,13 @@
 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')) return getallheaders();
45 45
 
46 46
         $headers = array();
47 47
 
48
-        foreach ( $_SERVER as $name => $value ) {
48
+        foreach ($_SERVER as $name => $value) {
49 49
 
50
-            if ( substr($name, 0, 5) == 'HTTP_' ) {
50
+            if (substr($name, 0, 5) == 'HTTP_') {
51 51
 
52 52
                 $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
53 53
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Request/Post.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
 
47 47
     private static function getParameters() {
48 48
 
49
-        switch( $_SERVER['REQUEST_METHOD'] ) {
49
+        switch ($_SERVER['REQUEST_METHOD']) {
50 50
 
51 51
             case 'POST':
52 52
 
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/Status.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
     public function set($code) {
50 50
 
51
-        if ( !$this->codes->exists($code) ) {
51
+        if (!$this->codes->exists($code)) {
52 52
 
53 53
             throw new Exception("Invalid HTTP Status Code $code");
54 54
 
@@ -60,9 +60,9 @@  discard block
 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/Components/HttpStatusCodes.php 1 patch
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.
src/Comodojo/Dispatcher/Events/DispatcherEvent.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 
30 30
     protected $dispatcher;
31 31
 
32
-    public function __construct( Dispatcher $dispatcher ) {
32
+    public function __construct(Dispatcher $dispatcher) {
33 33
 
34 34
         parent::__construct('dispatcher');
35 35
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Traits/HeadersTrait.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
 
29 29
     public function get($header = null) {
30 30
 
31
-        if ( is_null($header) ) return $this->headers;
31
+        if (is_null($header)) return $this->headers;
32 32
 
33
-        else if ( array_key_exists($header, $this->headers) ) return $this->headers[$header];
33
+        else if (array_key_exists($header, $this->headers)) return $this->headers[$header];
34 34
 
35 35
         else return null;
36 36
 
@@ -38,14 +38,14 @@  discard block
 block discarded – undo
38 38
 
39 39
     public function getAsString($header = null) {
40 40
 
41
-        if ( is_null($header) ) {
41
+        if (is_null($header)) {
42 42
 
43
-            return array_map( [$this, 'headerToString'],
43
+            return array_map([$this, 'headerToString'],
44 44
                 array_keys($this->headers),
45 45
                 array_values($this->headers)
46 46
             );
47 47
 
48
-        } else if ( array_key_exists($header, $this->headers) ) {
48
+        } else if (array_key_exists($header, $this->headers)) {
49 49
 
50 50
             return self::headerToString($header, $this->headers[$header]);
51 51
 
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 
54 54
     }
55 55
 
56
-    public function set($header, $value=null) {
56
+    public function set($header, $value = null) {
57 57
 
58
-        if ( is_null($value) ) {
58
+        if (is_null($value)) {
59 59
 
60 60
             $header = explode(":", $header, 2);
61 61
 
@@ -73,13 +73,13 @@  discard block
 block discarded – undo
73 73
 
74 74
     public function delete($header = null) {
75 75
 
76
-        if ( is_null($header) ) {
76
+        if (is_null($header)) {
77 77
 
78 78
             $this->headers = array();
79 79
 
80 80
             return true;
81 81
 
82
-        } else if ( array_key_exists($header, $this->headers) ) {
82
+        } else if (array_key_exists($header, $this->headers)) {
83 83
 
84 84
             unset($this->headers[$header]);
85 85
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Router/Route.php 1 patch
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.
src/Comodojo/Dispatcher/Router/Table.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -136,9 +136,9 @@  discard block
 block discarded – undo
136 136
 
137 137
     public function load($routes) {
138 138
 
139
-        if ( !empty($routes) ) {
139
+        if (!empty($routes)) {
140 140
 
141
-            foreach( $routes as $name => $route ) {
141
+            foreach ($routes as $name => $route) {
142 142
 
143 143
                 $this->add($route['route'], $route['type'], $route['class'], $route['parameters']);
144 144
                 // $this->add($name, $route['type'], $route['class'], $route['parameters']);
@@ -156,11 +156,11 @@  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) return;
160 160
 
161 161
         $data = $this->cache->read();
162 162
 
163
-        if ( is_null($data) ) {
163
+        if (is_null($data)) {
164 164
 
165 165
             $this->routes = [];
166 166
 
@@ -176,11 +176,11 @@  discard block
 block discarded – undo
176 176
 
177 177
     private function dumpCache() {
178 178
 
179
-        if ( $this->configuration->get('routing-table-cache') !== true ) return;
179
+        if ($this->configuration->get('routing-table-cache') !== true) return;
180 180
 
181 181
         $ttl = $this->configuration->get('routing-table-ttl');
182 182
 
183
-        if ( $this->cache->dump($this->routes, $ttl) ) {
183
+        if ($this->cache->dump($this->routes, $ttl)) {
184 184
             $this->logger->debug("Routing table saved to cache");
185 185
         } else {
186 186
             $this->logger->warning("Cannot save routing table to cache");
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
             ->setClassName($class) // Class to be invoked
199 199
             ->setParameters($parameters); // Parameters passed via the composer.json configuration (cache, ttl, etc...)
200 200
 
201
-        $this->logger->debug("Route table - route: " . implode("/", $folders));
201
+        $this->logger->debug("Route table - route: ".implode("/", $folders));
202 202
 
203 203
         // This method generate a global regular expression which will be able to match all the URI supported by the route
204 204
         $regex = $this->parser->read($folders, $route);
Please login to merge, or discard this patch.