Completed
Push — 4.0 ( 954171...ed2d0a )
by Marco
13:55
created
src/ObjectRoute/ObjectRoute.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
47 47
 
48 48
     private $parameters = array();
49 49
 
50
-    private $supported_route_types = array("ROUTE","REDIRECT","ERROR");
50
+    private $supported_route_types = array("ROUTE", "REDIRECT", "ERROR");
51 51
 
52
-    private $supported_redirect_codes = array(201,301,302,303,307);
52
+    private $supported_redirect_codes = array(201, 301, 302, 303, 307);
53 53
 
54
-    private $supported_error_codes = array(400,403,404,405,500,501,503);
54
+    private $supported_error_codes = array(400, 403, 404, 405, 500, 501, 503);
55 55
 
56
-    private $supported_cache_modes = array("SERVER","CLIENT","BOTH");
56
+    private $supported_cache_modes = array("SERVER", "CLIENT", "BOTH");
57 57
 
58 58
     /**
59 59
      * Set service name
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
      *
242 242
      * @return  ObjectRequest   $this
243 243
      */
244
-    public function setHeader($header, $value=null) {
244
+    public function setHeader($header, $value = null) {
245 245
 
246 246
         $this->headers[$header] = $value;
247 247
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
      */
259 259
     public function unsetHeader($header) {
260 260
 
261
-        if ( isset($this->headers[$header]) ) {
261
+        if (isset($this->headers[$header])) {
262 262
 
263 263
             unset($this->headers[$header]);
264 264
 
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
      */
280 280
     public function getHeader($header) {
281 281
 
282
-        if ( isset($this->headers[$header]) ) return $this->headers[$header];
282
+        if (isset($this->headers[$header])) return $this->headers[$header];
283 283
 
284 284
         return null;
285 285
 
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
      *
330 330
      * @return  ObjectRequest   $this
331 331
      */
332
-    public function setParameter($parameter, $value=null) {
332
+    public function setParameter($parameter, $value = null) {
333 333
 
334 334
         $this->parameters[$parameter] = $value;
335 335
 
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
      */
345 345
     public function getParameter($parameter) {
346 346
 
347
-        if ( isset($this->parameters[$parameter]) ) return $this->parameters[$parameter];
347
+        if (isset($this->parameters[$parameter])) return $this->parameters[$parameter];
348 348
 
349 349
         else return null;
350 350
 
Please login to merge, or discard this patch.
src/Serialization.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
      *
38 38
      * @return  string  JSON encoded data
39 39
      */
40
-    final public function toJson($data, $flags=null) {
40
+    final public function toJson($data, $flags = null) {
41 41
 
42
-        if ( !( is_array($data) OR is_object($data) ) ) throw new Exception("Invalid data for JSON serialization");
42
+        if (!(is_array($data) OR is_object($data))) throw new Exception("Invalid data for JSON serialization");
43 43
 
44 44
         return json_encode($data, $flags);
45 45
 
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
      *
56 56
      * @return  string  XML encoded data
57 57
      */
58
-    final public function toXml($data, $prettify=false) {
58
+    final public function toXml($data, $prettify = false) {
59 59
 
60
-        if ( !( is_array($data) OR is_object($data) ) ) throw new Exception("Invalid data for XML serialization");
60
+        if (!(is_array($data) OR is_object($data))) throw new Exception("Invalid data for XML serialization");
61 61
 
62
-        if ( is_object($data) ) $data = $this->objectToArray($data);
62
+        if (is_object($data)) $data = $this->objectToArray($data);
63 63
 
64 64
         $xmlEngine = new XML();
65 65
         
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
      */
104 104
     final public function toYaml($data) {
105 105
 
106
-        if ( !( is_array($data) OR is_object($data) ) ) throw new Exception("Invalid data for XML serialization");
106
+        if (!(is_array($data) OR is_object($data))) throw new Exception("Invalid data for XML serialization");
107 107
 
108
-        if ( is_object($data) ) $data = $this->objectToArray($data);
108
+        if (is_object($data)) $data = $this->objectToArray($data);
109 109
 
110 110
         return \Spyc::YAMLDump($data);
111 111
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
        
148 148
         $indent = '';
149 149
 
150
-        $xmlString = str_replace("\n","",$xmlString);
150
+        $xmlString = str_replace("\n", "", $xmlString);
151 151
         $xmlString = trim(preg_replace("/<\?[^>]+>/", "", $xmlString));
152 152
         $xmlString = preg_replace("/>([\s]+)<\//", "></", $xmlString);
153 153
         $xmlString = str_replace(">", ">\n", $xmlString);
@@ -156,23 +156,23 @@  discard block
 block discarded – undo
156 156
 
157 157
         $_xmlString = '';
158 158
         
159
-        foreach($xmlStringArray as $k=>$tag){
159
+        foreach ($xmlStringArray as $k=>$tag) {
160 160
 
161 161
             if ($tag == "") continue;
162 162
             
163
-            if ($tag[0]=="<" AND $tag[1] != "/") {
163
+            if ($tag[0] == "<" AND $tag[1] != "/") {
164 164
 
165 165
                 $_xmlString .= $indent.$tag."\n";
166 166
                 $indent .= '  ';
167 167
 
168
-            } elseif($tag[0]=="<" AND $tag[1] == "/") {
168
+            } elseif ($tag[0] == "<" AND $tag[1] == "/") {
169 169
 
170
-                $indent = substr($indent,0,strlen($indent)-2);
171
-                $_xmlString .= (substr($_xmlString,strlen($_xmlString)-1)==">" || substr($_xmlString,strlen($_xmlString)-1)=="\n" ? $indent : '').$tag."\n";
170
+                $indent = substr($indent, 0, strlen($indent)-2);
171
+                $_xmlString .= (substr($_xmlString, strlen($_xmlString)-1) == ">" || substr($_xmlString, strlen($_xmlString)-1) == "\n" ? $indent : '').$tag."\n";
172 172
 
173 173
             } else {
174 174
 
175
-                $_xmlString = substr($_xmlString,0,strlen($_xmlString)-1);
175
+                $_xmlString = substr($_xmlString, 0, strlen($_xmlString)-1);
176 176
                 $_xmlString .= $tag;
177 177
 
178 178
             }
@@ -191,11 +191,11 @@  discard block
 block discarded – undo
191 191
      */
192 192
     private function objectToArray($stdObj) {
193 193
        
194
-        if(is_object($stdObj)) {
194
+        if (is_object($stdObj)) {
195 195
 
196 196
             $array = array();
197 197
             
198
-            foreach($stdObj as $key=>$val){
198
+            foreach ($stdObj as $key=>$val) {
199 199
 
200 200
                 $array[$key] = objectToArray($val);
201 201
 
Please login to merge, or discard this patch.
src/Cache.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
             }
106 106
         }
107 107
         
108
-        $cacheTag = md5($request) . ".cache";
108
+        $cacheTag = md5($request).".cache";
109 109
 
110
-        $cacheFile = $this->cache_path . ( $this->cache_path[strlen($this->cache_path)-1] == "/" ? "" : "/" ) . $cacheTag;
110
+        $cacheFile = $this->cache_path.($this->cache_path[strlen($this->cache_path)-1] == "/" ? "" : "/").$cacheTag;
111 111
 
112 112
         $f_data = serialize($data);
113 113
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
      * 
139 139
      * @return  array   An array containing maxage, bestbefore, object (data)
140 140
      */
141
-    final public function get($request, $ttl=DISPATCHER_CACHE_TTL) {
141
+    final public function get($request, $ttl = DISPATCHER_CACHE_TTL) {
142 142
         
143 143
         if (!DISPATCHER_CACHE_ENABLED) {
144 144
 
@@ -148,19 +148,19 @@  discard block
 block discarded – undo
148 148
 
149 149
         }
150 150
         
151
-        $last_time_limit = (int)$this->current_time - $ttl;
151
+        $last_time_limit = (int)$this->current_time-$ttl;
152 152
         
153
-        $cacheTag = md5($request) . ".cache";
153
+        $cacheTag = md5($request).".cache";
154 154
 
155
-        $cacheFile = $this->cache_path . ( $this->cache_path[strlen($this->cache_path)-1] == "/" ? "" : "/" ) . $cacheTag;
155
+        $cacheFile = $this->cache_path.($this->cache_path[strlen($this->cache_path)-1] == "/" ? "" : "/").$cacheTag;
156 156
         
157 157
         $cache_time = @filemtime($cacheFile);
158 158
 
159 159
         if (is_readable($cacheFile) AND $cache_time >= $last_time_limit) {
160 160
             
161
-            $max_age = $cache_time + $ttl - (int)$this->current_time;
161
+            $max_age = $cache_time+$ttl-(int)$this->current_time;
162 162
 
163
-            $best_before = gmdate("D, d M Y H:i:s", $cache_time + $ttl) . " GMT";
163
+            $best_before = gmdate("D, d M Y H:i:s", $cache_time+$ttl)." GMT";
164 164
             
165 165
             $data = file_get_contents($cacheFile);
166 166
 
@@ -204,16 +204,16 @@  discard block
 block discarded – undo
204 204
      *
205 205
      * @return  bool
206 206
      */
207
-    public function purge($request=null) {
207
+    public function purge($request = null) {
208 208
 
209
-        if ( is_null($request) ) {
209
+        if (is_null($request)) {
210 210
 
211 211
             $this->logger->info('Purging whole cache');
212 212
 
213 213
             $cache_files_number = 0;
214 214
 
215 215
             $cache_path = opendir($this->cache_path);
216
-            if ( $cache_path === false ) {
216
+            if ($cache_path === false) {
217 217
 
218 218
                 $this->logger->error('Unable to open cache folder', array(
219 219
                     'CACHEFOLDER' => $this->cache_path
@@ -223,10 +223,10 @@  discard block
 block discarded – undo
223 223
 
224 224
             }
225 225
             
226
-            while( false !== ( $cache_file = readdir($cache_path) ) ) {
226
+            while (false !== ($cache_file = readdir($cache_path))) {
227 227
 
228
-                if ( pathinfo($cache_file, PATHINFO_EXTENSION) == "cache" ) {
229
-                    if ( unlink( $this->cache_path . ( $this->cache_path[strlen($this->cache_path)-1] == "/" ? "" : "/" ) . $cache_file ) == false ) return false;
228
+                if (pathinfo($cache_file, PATHINFO_EXTENSION) == "cache") {
229
+                    if (unlink($this->cache_path.($this->cache_path[strlen($this->cache_path)-1] == "/" ? "" : "/").$cache_file) == false) return false;
230 230
                     else $cache_files_number++;
231 231
                 }
232 232
                 else continue;
@@ -242,11 +242,11 @@  discard block
 block discarded – undo
242 242
                 'REQUEST' => $request
243 243
             ));
244 244
 
245
-            $cacheTag = md5($request) . ".cache";
245
+            $cacheTag = md5($request).".cache";
246 246
 
247
-            $cacheFile = $this->cache_path . ( $this->cache_path[strlen($this->cache_path)-1] == "/" ? "" : "/" ) . $cacheTag;
247
+            $cacheFile = $this->cache_path.($this->cache_path[strlen($this->cache_path)-1] == "/" ? "" : "/").$cacheTag;
248 248
 
249
-            if ( is_readable($cacheFile) ) {
249
+            if (is_readable($cacheFile)) {
250 250
 
251 251
                 $unlink = unlink($cacheFile);
252 252
                 $cache_files_number = $unlink ? 1 : false;
Please login to merge, or discard this patch.
src/ObjectRoutingTable/ObjectRoutingTable.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      *
49 49
      * @var array
50 50
      */
51
-    private $supported_route_types = array("ROUTE","REDIRECT","ERROR");
51
+    private $supported_route_types = array("ROUTE", "REDIRECT", "ERROR");
52 52
 
53 53
     /**
54 54
      * Object constructor.
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      *
78 78
      * @return  Object  $this
79 79
      */
80
-    public function setRoute($service, $type, $target, $parameters=array()) {
80
+    public function setRoute($service, $type, $target, $parameters = array()) {
81 81
 
82 82
         $this->table[$service] = array(
83 83
             "type"          =>  $type,
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
      */
99 99
     public function unsetRoute($service) {
100 100
 
101
-        if ( isset($this->table[$service]) ) {
101
+        if (isset($this->table[$service])) {
102 102
 
103 103
             unset($this->table[$service]);
104 104
 
@@ -121,17 +121,17 @@  discard block
 block discarded – undo
121 121
 
122 122
         // If service is null, route to landing or (if not specified) to default route
123 123
 
124
-        if ( empty($service) ) return $this->routeToLanding();
124
+        if (empty($service)) return $this->routeToLanding();
125 125
 
126 126
         // If service is in table, check if it is routable (in case of "ROUTE" route).
127 127
         // If true, route request
128 128
         // If false, return a 500 error
129 129
 
130
-        if ( isset($this->table[$service]) ) {
130
+        if (isset($this->table[$service])) {
131 131
 
132
-            if ( $this->table[$service]["type"] == "ROUTE" ) {
132
+            if ($this->table[$service]["type"] == "ROUTE") {
133 133
 
134
-                if ( $this->routable($this->table[$service]["target"]) ) return $this->table[$service];
134
+                if ($this->routable($this->table[$service]["target"])) return $this->table[$service];
135 135
 
136 136
                 else return $this->routeToNowhere();
137 137
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
         // If autoroute is enabled, try to match service name with a service file.
145 145
         // If true, try to route request
146 146
 
147
-        else if ( defined('DISPATCHER_AUTO_ROUTE') && DISPATCHER_AUTO_ROUTE === true AND $this->routable($service.".php", true) ) {
147
+        else if (defined('DISPATCHER_AUTO_ROUTE') && DISPATCHER_AUTO_ROUTE === true AND $this->routable($service.".php", true)) {
148 148
 
149 149
             return array(
150 150
                 "type"          =>  "ROUTE",
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
      *
179 179
      * @return  bool
180 180
      */
181
-    private function routable($target, $relative=false) {
181
+    private function routable($target, $relative = false) {
182 182
 
183
-        if ( $relative ) return is_readable(DISPATCHER_SERVICES_FOLDER.$target) ? true : false;
183
+        if ($relative) return is_readable(DISPATCHER_SERVICES_FOLDER.$target) ? true : false;
184 184
 
185 185
         else return is_readable($target) ? true : false;
186 186
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
      */
194 194
     private function routeToLanding() {
195 195
 
196
-        if ( isset($this->table[""]) ) {
196
+        if (isset($this->table[""])) {
197 197
 
198 198
             return $this->table[""];
199 199
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
      */
211 211
     private function routeToDefault() {
212 212
 
213
-        if ( isset($this->table["default"]) ) {
213
+        if (isset($this->table["default"])) {
214 214
 
215 215
             return $this->table["default"];
216 216
 
Please login to merge, or discard this patch.
src/ObjectRequest/ObjectRequest.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
      *
164 164
      * @return  Object  $this
165 165
      */
166
-    public function setAttribute($name=null, $value) {
166
+    public function setAttribute($name = null, $value) {
167 167
 
168
-        if ( is_null($name) ) array_push($this->attributes, $value);
168
+        if (is_null($name)) array_push($this->attributes, $value);
169 169
 
170 170
         else $this->attributes[$name] = $value;
171 171
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
      */
183 183
     public function unsetAttribute($attribute) {
184 184
 
185
-        if ( array_key_exists($attribute, $this->attributes) ) {
185
+        if (array_key_exists($attribute, $this->attributes)) {
186 186
 
187 187
             unset($this->attributes[$attribute]);
188 188
 
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
      */
204 204
     public function getAttribute($attribute) {
205 205
 
206
-        if ( array_key_exists($attribute, $this->attributes) ) {
206
+        if (array_key_exists($attribute, $this->attributes)) {
207 207
 
208 208
             return $this->attributes[$attribute];
209 209
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
      */
278 278
     public function unsetParameter($parameter) {
279 279
 
280
-        if ( array_key_exists($parameter, $this->parameters) ) {
280
+        if (array_key_exists($parameter, $this->parameters)) {
281 281
 
282 282
             unset($this->parameters[$parameter]);
283 283
 
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
      */
299 299
     public function getParameter($parameter) {
300 300
 
301
-        if ( array_key_exists($parameter, $this->parameters) ) {
301
+        if (array_key_exists($parameter, $this->parameters)) {
302 302
 
303 303
             return $this->parameters[$parameter];
304 304
 
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
      *
380 380
      * @return  ObjectRequest   $this
381 381
      */
382
-    public function setHeader($header, $value=null) {
382
+    public function setHeader($header, $value = null) {
383 383
 
384 384
         $this->headers[$header] = $value;
385 385
 
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
      */
397 397
     public function unsetHeader($header) {
398 398
 
399
-        if ( isset($this->headers[$header]) ) {
399
+        if (isset($this->headers[$header])) {
400 400
 
401 401
             unset($this->headers[$header]);
402 402
 
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
      */
418 418
     public function getHeader($header) {
419 419
 
420
-        if ( isset($this->headers[$header]) ) return $this->headers[$header];
420
+        if (isset($this->headers[$header])) return $this->headers[$header];
421 421
 
422 422
         return null;
423 423
 
Please login to merge, or discard this patch.
src/Header.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      *
48 48
      * @param   string  $time   Dispatcher time
49 49
      */
50
-    final public function __construct($time=false) {
50
+    final public function __construct($time = false) {
51 51
 
52 52
         $this->current_time = $time !== false ? $time : microtime(true);
53 53
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      * @param   mixed   $value    Header value (if not included in $header)
61 61
      * @return  Object  $this
62 62
      */
63
-    final public function set($header, $value=null) {
63
+    final public function set($header, $value = null) {
64 64
 
65 65
         $this->headers[$header] = $value;
66 66
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      */
78 78
     final public function get($header) {
79 79
 
80
-        if ( array_key_exists($header, $this->headers) ) return $this->headers[$header];
80
+        if (array_key_exists($header, $this->headers)) return $this->headers[$header];
81 81
 
82 82
         else return null;
83 83
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
      * @param   integer     $contentLength  Content length
114 114
      * @param   string      $value          (optional) value (see method description)
115 115
      */
116
-    final public function compose($status, $contentLength=0, $value=false) {
116
+    final public function compose($status, $contentLength = 0, $value = false) {
117 117
 
118 118
         switch ($status) {
119 119
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 
146 146
             header($_SERVER["SERVER_PROTOCOL"].' 204 No Content');
147 147
             header('Status: 204 No Content');
148
-            header('Content-Length: 0',true);
148
+            header('Content-Length: 0', true);
149 149
 
150 150
             $this->processExtraHeaders($this->headers);
151 151
             
@@ -157,13 +157,13 @@  discard block
 block discarded – undo
157 157
             case 303: //See Other
158 158
             case 307: //Temporary Redirect
159 159
 
160
-            header("Location: ".$value,true,$status);
160
+            header("Location: ".$value, true, $status);
161 161
             
162 162
             break;
163 163
 
164 164
             case 304: //Not Modified
165 165
 
166
-            if ( $value === false ) header($_SERVER["SERVER_PROTOCOL"].' 304 Not Modified');
166
+            if ($value === false) header($_SERVER["SERVER_PROTOCOL"].' 304 Not Modified');
167 167
             else header('Last-Modified: '.gmdate('D, d M Y H:i:s', $value).' GMT', true, 304);
168 168
 
169 169
                 if ($contentLength !== 0) header('Content-Length: '.$contentLength); //is it needed?
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 
198 198
             case 405: //Not allowed
199 199
 
200
-            header('Allow: ' . $value, true, 405); 
200
+            header('Allow: '.$value, true, 405); 
201 201
 
202 202
             break;
203 203
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 
210 210
             case 501: //Not implemented
211 211
 
212
-            header('Allow: ' . $value, true, 501);
212
+            header('Allow: '.$value, true, 501);
213 213
             
214 214
             break;
215 215
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 
218 218
             header('HTTP/1.1 503 Service Temporarily Unavailable');
219 219
             header('Status: 503 Service Temporarily Unavailable');
220
-            if ( $value !== false AND @is_int($value) ) {
220
+            if ($value !== false AND @is_int($value)) {
221 221
                 header('Retry-After: '.$value);
222 222
             }
223 223
             
@@ -237,13 +237,13 @@  discard block
 block discarded – undo
237 237
 
238 238
         $ttl = filter_var($ttl, FILTER_VALIDATE_INT);
239 239
 
240
-        if ( $ttl > 0 ) {
241
-            $this->set("Cache-Control","max-age=".$ttl.", must-revalidate");
242
-            $this->set("Expires",gmdate("D, d M Y H:i:s", (int)$this->current_time + $ttl)." GMT");
240
+        if ($ttl > 0) {
241
+            $this->set("Cache-Control", "max-age=".$ttl.", must-revalidate");
242
+            $this->set("Expires", gmdate("D, d M Y H:i:s", (int)$this->current_time+$ttl)." GMT");
243 243
         }
244 244
         else {
245
-            $this->set("Cache-Control","no-cache, must-revalidate");
246
-            $this->set("Expires","Mon, 26 Jul 1997 05:00:00 GMT");
245
+            $this->set("Cache-Control", "no-cache, must-revalidate");
246
+            $this->set("Expires", "Mon, 26 Jul 1997 05:00:00 GMT");
247 247
         }
248 248
 
249 249
         return $this;
@@ -257,11 +257,11 @@  discard block
 block discarded – undo
257 257
      * @param   string      $charset    Charset
258 258
      * @return  Object      $this
259 259
      */
260
-    public function setContentType($type, $charset=null) {
260
+    public function setContentType($type, $charset = null) {
261 261
 
262 262
 
263
-        if ( is_null($charset) ) $this->set("Content-type",strtolower($type));
264
-        else $this->set("Content-type",strtolower($type)."; charset=".$charset);
263
+        if (is_null($charset)) $this->set("Content-type", strtolower($type));
264
+        else $this->set("Content-type", strtolower($type)."; charset=".$charset);
265 265
 
266 266
         return $this;
267 267
 
@@ -298,9 +298,9 @@  discard block
 block discarded – undo
298 298
      */
299 299
     private function processExtraHeaders($headers) {
300 300
 
301
-        foreach ( $headers as $header => $value ) {
301
+        foreach ($headers as $header => $value) {
302 302
 
303
-            if ( is_null($value) ) header($header, true);
303
+            if (is_null($value)) header($header, true);
304 304
             else  header($header.": ".$value, true);
305 305
 
306 306
         }
Please login to merge, or discard this patch.
src/ObjectResult/ObjectRedirect.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
     private $code = 307;
31 31
 
32
-    private $supported_redirect_codes = array(201,301,302,303,307);
32
+    private $supported_redirect_codes = array(201, 301, 302, 303, 307);
33 33
 
34 34
     private $location = null;
35 35
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
      *
136 136
      * @return  ObjectRequest   $this
137 137
      */
138
-    public function setHeader($header, $value=null) {
138
+    public function setHeader($header, $value = null) {
139 139
 
140 140
         $this->headers[$header] = $value;
141 141
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
      */
153 153
     public function unsetHeader($header) {
154 154
 
155
-        if ( isset($this->headers[$header]) ) {
155
+        if (isset($this->headers[$header])) {
156 156
 
157 157
             unset($this->headers[$header]);
158 158
 
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
      */
174 174
     public function getHeader($header) {
175 175
 
176
-        if ( isset($this->headers[$header]) ) return $this->headers[$header];
176
+        if (isset($this->headers[$header])) return $this->headers[$header];
177 177
 
178 178
         return null;
179 179
 
Please login to merge, or discard this patch.
src/ObjectResult/ObjectSuccess.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 
38 38
     private $charset = DISPATCHER_DEFAULT_ENCODING;
39 39
 
40
-    private $supported_success_codes = array(200,202,204);
40
+    private $supported_success_codes = array(200, 202, 204);
41 41
 
42 42
     /**
43 43
      * Set service name
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
      *
138 138
      * @return  ObjectRequest   $this
139 139
      */
140
-    public function setHeader($header, $value=null) {
140
+    public function setHeader($header, $value = null) {
141 141
 
142 142
         $this->headers[$header] = $value;
143 143
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
      */
155 155
     public function unsetHeader($header) {
156 156
 
157
-        if ( isset($this->headers[$header]) ) {
157
+        if (isset($this->headers[$header])) {
158 158
 
159 159
             unset($this->headers[$header]);
160 160
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
      */
176 176
     public function getHeader($header) {
177 177
 
178
-        if ( isset($this->headers[$header]) ) return $this->headers[$header];
178
+        if (isset($this->headers[$header])) return $this->headers[$header];
179 179
 
180 180
         return null;
181 181
 
Please login to merge, or discard this patch.
src/ObjectResult/ObjectError.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
     private $code = 500;
31 31
 
32
-    private $supported_error_codes = array(400,403,404,405,500,501,503);
32
+    private $supported_error_codes = array(400, 403, 404, 405, 500, 501, 503);
33 33
 
34 34
     private $content = null;
35 35
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
      *
138 138
      * @return  ObjectRequest   $this
139 139
      */
140
-    public function setHeader($header, $value=null) {
140
+    public function setHeader($header, $value = null) {
141 141
 
142 142
         $this->headers[$header] = $value;
143 143
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
      */
155 155
     public function unsetHeader($header) {
156 156
 
157
-        if ( isset($this->headers[$header]) ) {
157
+        if (isset($this->headers[$header])) {
158 158
 
159 159
             unset($this->headers[$header]);
160 160
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
      */
176 176
     public function getHeader($header) {
177 177
 
178
-        if ( isset($this->headers[$header]) ) return $this->headers[$header];
178
+        if (isset($this->headers[$header])) return $this->headers[$header];
179 179
 
180 180
         return null;
181 181
 
Please login to merge, or discard this patch.