Completed
Push — 4.0 ( bf6233...a1234e )
by Marco
13:59
created
src/Comodojo/Dispatcher/Response/Preprocessor/Status200.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
         $type = $this->response()->content()->type();
34 34
         $charset = $this->response()->content()->charset();
35 35
 
36
-        if ( is_null($charset) ) {
36
+        if (is_null($charset)) {
37 37
             $this->response()->headers()->set("Content-type", strtolower($type));
38 38
         } else {
39 39
             $this->response()->headers()->set("Content-type", strtolower($type)."; charset=".$charset);
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Response/Content.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 
39 39
     }
40 40
 
41
-    public function set($content=null) {
41
+    public function set($content = null) {
42 42
 
43
-        if ( !is_scalar($content) && $content != null ) {
43
+        if (!is_scalar($content) && $content != null) {
44 44
 
45 45
             throw new Exception("Invalid HTTP content");
46 46
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
     public function type($type = null) {
56 56
 
57
-        if ( is_null($type) ) {
57
+        if (is_null($type)) {
58 58
 
59 59
             return $this->type;
60 60
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
     public function charset($charset = null) {
70 70
 
71
-        if ( is_null($charset) ) {
71
+        if (is_null($charset)) {
72 72
 
73 73
             return $this->charset;
74 74
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Response/Model.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         $output_class_name = "\\Comodojo\\Dispatcher\\Response\\Preprocessor\\Status".$status;
103 103
 
104 104
         // @TODO: this condition will be removed when all preprocessors ready
105
-        if ( class_exists($output_class_name) ) {
105
+        if (class_exists($output_class_name)) {
106 106
             $output = new $output_class_name($this);
107 107
         } else {
108 108
             $output = new \Comodojo\Dispatcher\Response\Preprocessor\Status200($this);
@@ -110,13 +110,13 @@  discard block
 block discarded – undo
110 110
 
111 111
         $output->consolidate();
112 112
 
113
-        if ( $route != null ) {
113
+        if ($route != null) {
114 114
             $this->setClientCache($request, $route);
115 115
         }
116 116
 
117 117
         // extra checks
118 118
 
119
-        if ( $request->method()->get() == 'HEAD' && !in_array($status, array(100,101,102,204,304)) ) {
119
+        if ($request->method()->get() == 'HEAD' && !in_array($status, array(100, 101, 102, 204, 304))) {
120 120
             $length = $this->content()->length();
121 121
             $this->content()->set(null);
122 122
             if ($length) $this->headers()->set('Content-Length', $length);
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
             $this->headers()->delete('Content-Length');
127 127
         }
128 128
 
129
-        if ( $request->version()->get() == '1.0' && false !== strpos($this->headers->get('Cache-Control'), 'no-cache')) {
129
+        if ($request->version()->get() == '1.0' && false !== strpos($this->headers->get('Cache-Control'), 'no-cache')) {
130 130
             $this->headers()->set('pragma', 'no-cache');
131 131
             $this->headers()->set('expires', -1);
132 132
         }
@@ -146,15 +146,15 @@  discard block
 block discarded – undo
146 146
             //        the cache layer will be improoved in future versions.
147 147
         ) {
148 148
 
149
-            if ( $ttl > 0 ) {
149
+            if ($ttl > 0) {
150 150
 
151
-                $this->headers()->set("Cache-Control","max-age=".$ttl.", must-revalidate");
152
-                $this->headers()->set("Expires",gmdate("D, d M Y H:i:s", (int)$this->getTimestamp() + $ttl)." GMT");
151
+                $this->headers()->set("Cache-Control", "max-age=".$ttl.", must-revalidate");
152
+                $this->headers()->set("Expires", gmdate("D, d M Y H:i:s", (int)$this->getTimestamp()+$ttl)." GMT");
153 153
 
154 154
             } else {
155 155
 
156
-                $this->headers()->set("Cache-Control","no-cache, must-revalidate");
157
-                $this->headers()->set("Expires","Mon, 26 Jul 1997 05:00:00 GMT");
156
+                $this->headers()->set("Cache-Control", "no-cache, must-revalidate");
157
+                $this->headers()->set("Expires", "Mon, 26 Jul 1997 05:00:00 GMT");
158 158
 
159 159
             }
160 160
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -119,7 +119,9 @@
 block discarded – undo
119 119
         if ( $request->method()->get() == 'HEAD' && !in_array($status, array(100,101,102,204,304)) ) {
120 120
             $length = $this->content()->length();
121 121
             $this->content()->set(null);
122
-            if ($length) $this->headers()->set('Content-Length', $length);
122
+            if ($length) {
123
+                $this->headers()->set('Content-Length', $length);
124
+            }
123 125
         }
124 126
 
125 127
         if ($this->headers()->get('Transfer-Encoding') != null) {
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Service/AbstractService.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -96,9 +96,9 @@  discard block
 block discarded – undo
96 96
 
97 97
         $supported_methods = $this->configuration()->get('supported-http-methods');
98 98
 
99
-        if ( is_null($supported_methods) ) $supported_methods = array('GET','PUT','POST','DELETE','OPTIONS','HEAD','TRACE','CONNECT','PURGE');
99
+        if (is_null($supported_methods)) $supported_methods = array('GET', 'PUT', 'POST', 'DELETE', 'OPTIONS', 'HEAD', 'TRACE', 'CONNECT', 'PURGE');
100 100
 
101
-        if ( method_exists($this, 'any') ) {
101
+        if (method_exists($this, 'any')) {
102 102
 
103 103
             return $supported_methods;
104 104
 
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
 
107 107
         $implemented_methods = array();
108 108
 
109
-        foreach ( $supported_methods as $method ) {
109
+        foreach ($supported_methods as $method) {
110 110
 
111
-            if ( method_exists($this, strtolower($method)) ) array_push($implemented_methods,$method);
111
+            if (method_exists($this, strtolower($method))) array_push($implemented_methods, $method);
112 112
 
113 113
         }
114 114
 
@@ -122,11 +122,11 @@  discard block
 block discarded – undo
122 122
      */
123 123
     public function getMethod($method) {
124 124
 
125
-        if ( method_exists($this, strtolower($method)) ) {
125
+        if (method_exists($this, strtolower($method))) {
126 126
 
127 127
             return strtolower($method);
128 128
 
129
-        } else if ( method_exists($this, strtolower('any')) ) {
129
+        } else if (method_exists($this, strtolower('any'))) {
130 130
 
131 131
             return 'any';
132 132
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -96,7 +96,9 @@  discard block
 block discarded – undo
96 96
 
97 97
         $supported_methods = $this->configuration()->get('supported-http-methods');
98 98
 
99
-        if ( is_null($supported_methods) ) $supported_methods = array('GET','PUT','POST','DELETE','OPTIONS','HEAD','TRACE','CONNECT','PURGE');
99
+        if ( is_null($supported_methods) ) {
100
+            $supported_methods = array('GET','PUT','POST','DELETE','OPTIONS','HEAD','TRACE','CONNECT','PURGE');
101
+        }
100 102
 
101 103
         if ( method_exists($this, 'any') ) {
102 104
 
@@ -108,7 +110,9 @@  discard block
 block discarded – undo
108 110
 
109 111
         foreach ( $supported_methods as $method ) {
110 112
 
111
-            if ( method_exists($this, strtolower($method)) ) array_push($implemented_methods,$method);
113
+            if ( method_exists($this, strtolower($method)) ) {
114
+                array_push($implemented_methods,$method);
115
+            }
112 116
 
113 117
         }
114 118
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Output/Processor.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@
 block discarded – undo
130 130
 
131 131
         $status = $this->response->status()->get();
132 132
 
133
-        if ( !array_key_exists($status, $this->codes) ) throw new Exception("Invalid HTTP status code in response");
133
+        if (!array_key_exists($status, $this->codes)) throw new Exception("Invalid HTTP status code in response");
134 134
 
135 135
         $message = $this->codes[$status];
136 136
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -130,7 +130,9 @@
 block discarded – undo
130 130
 
131 131
         $status = $this->response->status()->get();
132 132
 
133
-        if ( !array_key_exists($status, $this->codes) ) throw new Exception("Invalid HTTP status code in response");
133
+        if ( !array_key_exists($status, $this->codes) ) {
134
+            throw new Exception("Invalid HTTP status code in response");
135
+        }
134 136
 
135 137
         $message = $this->codes[$status];
136 138
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Response/File.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     public function getLocalName() {
63 63
         
64 64
         if (!empty($this->path))
65
-            return $this->path . "/" . $this->slug;
65
+            return $this->path."/".$this->slug;
66 66
         else
67 67
             return '';
68 68
     
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
             !empty($this->path) &&
118 118
             !empty($this->slug) &&
119 119
             file_exists($this->getLocalName()) &&
120
-            file_exists($this->getLocalName() . ".data")
120
+            file_exists($this->getLocalName().".data")
121 121
         );
122 122
     
123 123
     }
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
     
203 203
     private function loadFileInfo() {
204 204
         
205
-        $info = $this->getLocalName() . ".data";
205
+        $info = $this->getLocalName().".data";
206 206
         
207 207
         if (file_exists($info)) {
208 208
             
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
     
224 224
     private function saveFileInfo() {
225 225
         
226
-        $info = $this->getLocalName() . ".data";
226
+        $info = $this->getLocalName().".data";
227 227
         
228 228
         if (!empty($this->path) && file_exists($this->path)) {
229 229
             
@@ -248,17 +248,17 @@  discard block
 block discarded – undo
248 248
         
249 249
         preg_match_all("/[a-z0-9]+/", iconv("UTF-8", "ASCII//TRANSLIT", strtolower(preg_replace('/\..*?$/', '', $this->fname))), $matches);
250 250
         
251
-        $this->slug  = implode('-', $matches[0]);
251
+        $this->slug = implode('-', $matches[0]);
252 252
         
253 253
         if (!empty($this->path)) {
254 254
             
255
-            $files = glob($this->path . "/" . $slug . "*");
255
+            $files = glob($this->path."/".$slug."*");
256 256
             
257
-            $count = count ($files);
257
+            $count = count($files);
258 258
             
259 259
             if ($count > 0) {
260 260
                 
261
-                $this->slug .= "-" . $count;
261
+                $this->slug .= "-".$count;
262 262
                 
263 263
             }
264 264
             
Please login to merge, or discard this patch.
Braces   +11 added lines, -8 removed lines patch added patch discarded remove patch
@@ -61,10 +61,11 @@  discard block
 block discarded – undo
61 61
     
62 62
     public function getLocalName() {
63 63
         
64
-        if (!empty($this->path))
65
-            return $this->path . "/" . $this->slug;
66
-        else
67
-            return '';
64
+        if (!empty($this->path)) {
65
+                    return $this->path . "/" . $this->slug;
66
+        } else {
67
+                    return '';
68
+        }
68 69
     
69 70
     }
70 71
     
@@ -101,11 +102,13 @@  discard block
 block discarded – undo
101 102
     public function getFileData() {
102 103
    
103 104
         $file = $this->getTemporaryName();
104
-        if (empty($file))
105
-            $file = $this->getLocalName();
105
+        if (empty($file)) {
106
+                    $file = $this->getLocalName();
107
+        }
106 108
         
107
-        if (file_exists($file))
108
-            return file_get_contents($file);
109
+        if (file_exists($file)) {
110
+                    return file_get_contents($file);
111
+        }
109 112
         
110 113
         throw new DispatcherException("File does not exists");
111 114
     
Please login to merge, or discard this patch.