Completed
Push — 4.0 ( 125a8d...b89114 )
by Marco
08:12
created
src/Comodojo/Dispatcher/Traits/HeadersTrait.php 1 patch
Braces   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,11 +28,13 @@
 block discarded – undo
28 28
 
29 29
     public function get($header = null) {
30 30
 
31
-        if (is_null($header)) return $this->headers;
32
-
33
-        else if (array_key_exists($header, $this->headers)) return $this->headers[$header];
34
-
35
-        else return null;
31
+        if (is_null($header)) {
32
+            return $this->headers;
33
+        } else if (array_key_exists($header, $this->headers)) {
34
+            return $this->headers[$header];
35
+        } else {
36
+            return null;
37
+        }
36 38
 
37 39
     }
38 40
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Response/Preprocessor/Status201.php 1 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->getLocation()->get();
32 32
 
33
-        if ($location != null) $this->response->getHeaders()->set("Location", $location);
33
+        if ($location != null) {
34
+            $this->response->getHeaders()->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 1 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->getLocation()->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->getHeaders()->set("Location", $location);
38 40
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Response/Preprocessor/Status405.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,9 @@
 block discarded – undo
33 33
         // An Allow Header should be provided from DispatcherException
34 34
         $allow = $this->response->getHeaders()->get('Allow');
35 35
 
36
-        if (is_null($allow)) throw new Exception("Missing Allow header");
36
+        if (is_null($allow)) {
37
+            throw new Exception("Missing Allow header");
38
+        }
37 39
 
38 40
         parent::consolidate();
39 41
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Response/Model.php 2 patches
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -159,14 +159,24 @@
 block discarded – undo
159 159
 
160 160
     public function import($data) {
161 161
 
162
-        if (isset($data->headers)) $this->setHeaders($data->headers);
163
-        if (isset($data->status)) $this->setStatus($data->status);
164
-        if (isset($data->content)) $this->setContent($data->content);
165
-        if (isset($data->location)) $this->setLocation($data->location);
162
+        if (isset($data->headers)) {
163
+            $this->setHeaders($data->headers);
164
+        }
165
+        if (isset($data->status)) {
166
+            $this->setStatus($data->status);
167
+        }
168
+        if (isset($data->content)) {
169
+            $this->setContent($data->content);
170
+        }
171
+        if (isset($data->location)) {
172
+            $this->setLocation($data->location);
173
+        }
166 174
 
167 175
         if (isset($data->cookies) && is_array($data->cookies)) {
168 176
             $cookies = $this->getCookies();
169
-            foreach ($data->cookies as $name => $cookie) $cookies->add($cookie);
177
+            foreach ($data->cookies as $name => $cookie) {
178
+                $cookies->add($cookie);
179
+            }
170 180
         }
171 181
 
172 182
     }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -229,7 +229,7 @@
 block discarded – undo
229 229
         ) {
230 230
 
231 231
             $headers = $this->getHeaders();
232
-            $timestamp = (int) $this->getTime()->format('U')+$ttl;
232
+            $timestamp = (int)$this->getTime()->format('U')+$ttl;
233 233
 
234 234
             if ($ttl > 0) {
235 235
 
Please login to merge, or discard this patch.