Completed
Push — master ( 276db7...0bd148 )
by Rakesh
07:30 queued 03:39
created
lib/Zend/Http/Client/Adapter/Curl.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -134,21 +134,21 @@  discard block
 block discarded – undo
134 134
         if ($config instanceof Zend_Config) {
135 135
             $config = $config->toArray();
136 136
 
137
-        } elseif (! is_array($config)) {
137
+        } elseif (!is_array($config)) {
138 138
             require_once 'Zend/Http/Client/Adapter/Exception.php';
139 139
             throw new Zend_Http_Client_Adapter_Exception(
140 140
                 'Array or Zend_Config object expected, got ' . gettype($config)
141 141
             );
142 142
         }
143 143
 
144
-        if(isset($config['proxy_user']) && isset($config['proxy_pass'])) {
145
-            $this->setCurlOption(CURLOPT_PROXYUSERPWD, $config['proxy_user'].":".$config['proxy_pass']);
144
+        if (isset($config['proxy_user']) && isset($config['proxy_pass'])) {
145
+            $this->setCurlOption(CURLOPT_PROXYUSERPWD, $config['proxy_user'] . ":" . $config['proxy_pass']);
146 146
             unset($config['proxy_user'], $config['proxy_pass']);
147 147
         }
148 148
 
149 149
         foreach ($config as $k => $v) {
150 150
             $option = strtolower($k);
151
-            switch($option) {
151
+            switch ($option) {
152 152
                 case 'proxy_host':
153 153
                     $this->setCurlOption(CURLOPT_PROXY, $v);
154 154
                     break;
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
             $this->close();
242 242
 
243 243
             require_once 'Zend/Http/Client/Adapter/Exception.php';
244
-            throw new Zend_Http_Client_Adapter_Exception('Unable to Connect to ' .  $host . ':' . $port);
244
+            throw new Zend_Http_Client_Adapter_Exception('Unable to Connect to ' . $host . ':' . $port);
245 245
         }
246 246
 
247 247
         if ($secure !== false) {
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
             case Zend_Http_Client::PUT:
300 300
                 // There are two different types of PUT request, either a Raw Data string has been set
301 301
                 // or CURLOPT_INFILE and CURLOPT_INFILESIZE are used.
302
-                if(is_resource($body)) {
302
+                if (is_resource($body)) {
303 303
                     $this->_config['curloptions'][CURLOPT_INFILE] = $body;
304 304
                 }
305 305
                 if (isset($this->_config['curloptions'][CURLOPT_INFILE])) {
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
                     // from $headers at this point:
308 308
                     foreach ($headers AS $k => $header) {
309 309
                         if (preg_match('/Content-Length:\s*(\d+)/i', $header, $m)) {
310
-                            if(is_resource($body)) {
310
+                            if (is_resource($body)) {
311 311
                                 $this->_config['curloptions'][CURLOPT_INFILESIZE] = (int)$m[1];
312 312
                             }
313 313
                             unset($headers[$k]);
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
                         throw new Zend_Http_Client_Adapter_Exception("Cannot set a file-handle for cURL option CURLOPT_INFILE without also setting its size in CURLOPT_INFILESIZE.");
320 320
                     }
321 321
 
322
-                    if(is_resource($body)) {
322
+                    if (is_resource($body)) {
323 323
                         $body = '';
324 324
                     }
325 325
 
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
                 throw new Zend_Http_Client_Adapter_Exception("Method currently not supported");
362 362
         }
363 363
 
364
-        if(is_resource($body) && $curlMethod != CURLOPT_PUT) {
364
+        if (is_resource($body) && $curlMethod != CURLOPT_PUT) {
365 365
             require_once 'Zend/Http/Client/Adapter/Exception.php';
366 366
             throw new Zend_Http_Client_Adapter_Exception("Streaming requests are allowed only with PUT");
367 367
         }
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
         curl_setopt($this->_curl, CURLOPT_HTTP_VERSION, $curlHttp);
374 374
         curl_setopt($this->_curl, $curlMethod, $curlValue);
375 375
 
376
-        if($this->out_stream) {
376
+        if ($this->out_stream) {
377 377
             // headers will be read into the response
378 378
             curl_setopt($this->_curl, CURLOPT_HEADER, false);
379 379
             curl_setopt($this->_curl, CURLOPT_HEADERFUNCTION, array($this, "readHeader"));
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
         $response = curl_exec($this->_curl);
437 437
 
438 438
         // if we used streaming, headers are already there
439
-        if(!is_resource($this->out_stream)) {
439
+        if (!is_resource($this->out_stream)) {
440 440
             $this->_response = $response;
441 441
         }
442 442
 
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
      */
489 489
     public function close()
490 490
     {
491
-        if(is_resource($this->_curl)) {
491
+        if (is_resource($this->_curl)) {
492 492
             curl_close($this->_curl);
493 493
         }
494 494
         $this->_curl         = null;
Please login to merge, or discard this patch.
lib/Zend/Http/Client/Adapter/Proxy.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
             // Check to see if one already exists
159 159
             $hasProxyAuthHeader = false;
160 160
             foreach ($headers as $k => $v) {
161
-                if ((string) $k == 'proxy-authorization'
161
+                if ((string)$k == 'proxy-authorization'
162 162
                     || preg_match("/^proxy-authorization:/i", $v)
163 163
                 ) {
164 164
                     $hasProxyAuthHeader = true;
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
             $request .= "$v\r\n";
203 203
         }
204 204
 
205
-        if(is_resource($body)) {
205
+        if (is_resource($body)) {
206 206
             $request .= "\r\n";
207 207
         } else {
208 208
             // Add the request body
@@ -217,8 +217,8 @@  discard block
 block discarded – undo
217 217
             );
218 218
         }
219 219
 
220
-        if(is_resource($body)) {
221
-            if(stream_copy_to_stream($body, $this->socket) == 0) {
220
+        if (is_resource($body)) {
221
+            if (stream_copy_to_stream($body, $this->socket) == 0) {
222 222
                 require_once 'Zend/Http/Client/Adapter/Exception.php';
223 223
                 throw new Zend_Http_Client_Adapter_Exception(
224 224
                     'Error writing request to server'
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 
249 249
         // Process provided headers, including important ones to CONNECT request
250 250
         foreach ($headers as $k => $v) {
251
-            switch (strtolower(substr($v,0,strpos($v,':')))) {
251
+            switch (strtolower(substr($v, 0, strpos($v, ':')))) {
252 252
                 case 'proxy-authorization':
253 253
                     // break intentionally omitted
254 254
 
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
         );
305 305
 
306 306
         $success = false;
307
-        foreach($modes as $mode) {
307
+        foreach ($modes as $mode) {
308 308
             $success = stream_socket_enable_crypto($this->socket, true, $mode);
309 309
             if ($success) {
310 310
                 break;
Please login to merge, or discard this patch.
lib/Zend/Http/Client/Adapter/Test.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
      */
94 94
     public function setNextRequestWillFail($flag)
95 95
     {
96
-        $this->_nextRequestWillFail = (bool) $flag;
96
+        $this->_nextRequestWillFail = (bool)$flag;
97 97
 
98 98
         return $this;
99 99
     }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         if ($config instanceof Zend_Config) {
109 109
             $config = $config->toArray();
110 110
 
111
-        } elseif (! is_array($config)) {
111
+        } elseif (!is_array($config)) {
112 112
             require_once 'Zend/Http/Client/Adapter/Exception.php';
113 113
             throw new Zend_Http_Client_Adapter_Exception(
114 114
                 'Array or Zend_Config object expected, got ' . gettype($config)
Please login to merge, or discard this patch.
lib/Zend/Http/Response.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         // Redirection 3xx
57 57
         300 => 'Multiple Choices',
58 58
         301 => 'Moved Permanently',
59
-        302 => 'Found',  // 1.1
59
+        302 => 'Found', // 1.1
60 60
         303 => 'See Other',
61 61
         304 => 'Not Modified',
62 62
         305 => 'Use Proxy',
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         $this->body = $body;
178 178
 
179 179
         // Set the HTTP version
180
-        if (! preg_match('|^\d\.\d$|', $version)) {
180
+        if (!preg_match('|^\d\.\d$|', $version)) {
181 181
             require_once 'Zend/Http/Exception.php';
182 182
             throw new Zend_Http_Exception("Invalid HTTP response version: $version");
183 183
         }
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
     public function getHeader($header)
353 353
     {
354 354
         $header = ucwords(strtolower($header));
355
-        if (! is_string($header) || ! isset($this->headers[$header])) return null;
355
+        if (!is_string($header) || !isset($this->headers[$header])) return null;
356 356
 
357 357
         return $this->headers[$header];
358 358
     }
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
     public static function responseCodeAsText($code = null, $http11 = true)
425 425
     {
426 426
         $messages = self::$messages;
427
-        if (! $http11) $messages[302] = 'Moved Temporarily';
427
+        if (!$http11) $messages[302] = 'Moved Temporarily';
428 428
 
429 429
         if ($code === null) {
430 430
             return $messages;
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
         preg_match("|^HTTP/[\d\.x]+ (\d+)|", $response_str, $m);
447 447
 
448 448
         if (isset($m[1])) {
449
-            return (int) $m[1];
449
+            return (int)$m[1];
450 450
         } else {
451 451
             return false;
452 452
         }
@@ -498,14 +498,14 @@  discard block
 block discarded – undo
498 498
 
499 499
         // First, split body and headers
500 500
         $parts = preg_split('|(?:\r?\n){2}|m', $response_str, 2);
501
-        if (! $parts[0]) return $headers;
501
+        if (!$parts[0]) return $headers;
502 502
 
503 503
         // Split headers part to lines
504 504
         $lines = explode("\n", $parts[0]);
505 505
         unset($parts);
506 506
         $last_header = null;
507 507
 
508
-        foreach($lines as $line) {
508
+        foreach ($lines as $line) {
509 509
             $line = trim($line, "\r\n");
510 510
             if ($line == "") break;
511 511
 
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
                 $h_value = $m[2];
517 517
 
518 518
                 if (isset($headers[$h_name])) {
519
-                    if (! is_array($headers[$h_name])) {
519
+                    if (!is_array($headers[$h_name])) {
520 520
                         $headers[$h_name] = array($headers[$h_name]);
521 521
                     }
522 522
 
@@ -567,14 +567,14 @@  discard block
 block discarded – undo
567 567
         // If mbstring overloads substr and strlen functions, we have to
568 568
         // override it's internal encoding
569 569
         if (function_exists('mb_internal_encoding') &&
570
-           ((int) ini_get('mbstring.func_overload')) & 2) {
570
+           ((int)ini_get('mbstring.func_overload')) & 2) {
571 571
 
572 572
             $mbIntEnc = mb_internal_encoding();
573 573
             mb_internal_encoding('ASCII');
574 574
         }
575 575
 
576 576
         while (trim($body)) {
577
-            if (! preg_match("/^([\da-fA-F]+)[^\r\n]*\r\n/sm", $body, $m)) {
577
+            if (!preg_match("/^([\da-fA-F]+)[^\r\n]*\r\n/sm", $body, $m)) {
578 578
                 require_once 'Zend/Http/Exception.php';
579 579
                 throw new Zend_Http_Exception("Error parsing body - doesn't seem to be a chunked message");
580 580
             }
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
      */
603 603
     public static function decodeGzip($body)
604 604
     {
605
-        if (! function_exists('gzinflate')) {
605
+        if (!function_exists('gzinflate')) {
606 606
             require_once 'Zend/Http/Exception.php';
607 607
             throw new Zend_Http_Exception(
608 608
                 'zlib extension is required in order to decode "gzip" encoding'
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
      */
623 623
     public static function decodeDeflate($body)
624 624
     {
625
-        if (! function_exists('gzuncompress')) {
625
+        if (!function_exists('gzuncompress')) {
626 626
             require_once 'Zend/Http/Exception.php';
627 627
             throw new Zend_Http_Exception(
628 628
                 'zlib extension is required in order to decode "deflate" encoding'
Please login to merge, or discard this patch.
lib/Zend/Http/Response/Stream.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
     public function __construct($code, $headers, $body = null, $version = '1.1', $message = null)
140 140
     {
141 141
 
142
-        if(is_resource($body)) {
142
+        if (is_resource($body)) {
143 143
             $this->setStream($body);
144 144
             $body = '';
145 145
         }
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
      */
178 178
     public function getBody()
179 179
     {
180
-        if($this->stream != null) {
180
+        if ($this->stream != null) {
181 181
             $this->readStream();
182 182
         }
183 183
         return parent::getBody();
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
      */
194 194
     public function getRawBody()
195 195
     {
196
-        if($this->stream) {
196
+        if ($this->stream) {
197 197
             $this->readStream();
198 198
         }
199 199
         return $this->body;
@@ -208,11 +208,11 @@  discard block
 block discarded – undo
208 208
      */
209 209
     protected function readStream()
210 210
     {
211
-        if(!is_resource($this->stream)) {
211
+        if (!is_resource($this->stream)) {
212 212
             return '';
213 213
         }
214 214
 
215
-        if(isset($headers['content-length'])) {
215
+        if (isset($headers['content-length'])) {
216 216
             $this->body = stream_get_contents($this->stream, $headers['content-length']);
217 217
         } else {
218 218
             $this->body = stream_get_contents($this->stream);
@@ -223,11 +223,11 @@  discard block
 block discarded – undo
223 223
 
224 224
     public function __destruct()
225 225
     {
226
-        if(is_resource($this->stream)) {
226
+        if (is_resource($this->stream)) {
227 227
             fclose($this->stream);
228 228
             $this->stream = null;
229 229
         }
230
-        if($this->_cleanup) {
230
+        if ($this->_cleanup) {
231 231
             @unlink($this->stream_name);
232 232
         }
233 233
     }
Please login to merge, or discard this patch.
lib/Zend/Http/Client.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
         }
319 319
 
320 320
         // We have no ports, set the defaults
321
-        if (! $uri->getPort()) {
321
+        if (!$uri->getPort()) {
322 322
             $uri->setPort(($uri->getScheme() == 'https' ? 443 : 80));
323 323
         }
324 324
 
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
         if ($config instanceof Zend_Config) {
355 355
             $config = $config->toArray();
356 356
 
357
-        } elseif (! is_array($config)) {
357
+        } elseif (!is_array($config)) {
358 358
             /** @see Zend_Http_Client_Exception */
359 359
             require_once 'Zend/Http/Client/Exception.php';
360 360
             throw new Zend_Http_Client_Exception('Array or Zend_Config object expected, got ' . gettype($config));
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
      */
386 386
     public function setMethod($method = self::GET)
387 387
     {
388
-        if (! preg_match('/^[^\x00-\x1f\x7f-\xff\(\)<>@,;:\\\\"\/\[\]\?={}\s]+$/', $method)) {
388
+        if (!preg_match('/^[^\x00-\x1f\x7f-\xff\(\)<>@,;:\\\\"\/\[\]\?={}\s]+$/', $method)) {
389 389
             require_once 'Zend/Http/Client/Exception.php';
390 390
             throw new Zend_Http_Client_Exception("'{$method}' is not a valid HTTP request method.");
391 391
         }
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
             }
443 443
 
444 444
             // Make sure the name is valid if we are in strict mode
445
-            if ($this->config['strict'] && (! preg_match('/^[a-zA-Z0-9-]+$/', $name))) {
445
+            if ($this->config['strict'] && (!preg_match('/^[a-zA-Z0-9-]+$/', $name))) {
446 446
                 /** @see Zend_Http_Client_Exception */
447 447
                 require_once 'Zend/Http/Client/Exception.php';
448 448
                 throw new Zend_Http_Client_Exception("{$name} is not a valid HTTP header name");
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
                 break;
543 543
             case 'post':
544 544
                 $parray = &$this->paramsPost;
545
-                if ( $value === null ) {
545
+                if ($value === null) {
546 546
                     if (isset($this->body_field_order[$name]))
547 547
                         unset($this->body_field_order[$name]);
548 548
                 } else {
@@ -605,15 +605,15 @@  discard block
 block discarded – undo
605 605
         // Else, set up authentication
606 606
         } else {
607 607
             // Check we got a proper authentication type
608
-            if (! defined('self::AUTH_' . strtoupper($type))) {
608
+            if (!defined('self::AUTH_' . strtoupper($type))) {
609 609
                 /** @see Zend_Http_Client_Exception */
610 610
                 require_once 'Zend/Http/Client/Exception.php';
611 611
                 throw new Zend_Http_Client_Exception("Invalid or not supported authentication type: '$type'");
612 612
             }
613 613
 
614 614
             $this->auth = array(
615
-                'user' => (string) $user,
616
-                'password' => (string) $password,
615
+                'user' => (string)$user,
616
+                'password' => (string)$password,
617 617
                 'type' => $type
618 618
             );
619 619
         }
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
             $this->cookiejar = $cookiejar;
640 640
         } elseif ($cookiejar === true) {
641 641
             $this->cookiejar = new Zend_Http_CookieJar();
642
-        } elseif (! $cookiejar) {
642
+        } elseif (!$cookiejar) {
643 643
             $this->cookiejar = null;
644 644
         } else {
645 645
             /** @see Zend_Http_Client_Exception */
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
 
714 714
             $value = addslashes($value);
715 715
 
716
-            if (! isset($this->headers['cookie'])) {
716
+            if (!isset($this->headers['cookie'])) {
717 717
                 $this->headers['cookie'] = array('Cookie', '');
718 718
             }
719 719
             $this->headers['cookie'][1] .= $cookie . '=' . $value . '; ';
@@ -751,7 +751,7 @@  discard block
 block discarded – undo
751 751
                 throw new Zend_Http_Client_Exception("Unable to read file '{$filename}' for upload");
752 752
             }
753 753
 
754
-            if (! $ctype) {
754
+            if (!$ctype) {
755 755
                 $ctype = $this->_detectFileMimeType($filename);
756 756
             }
757 757
         }
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
         if (is_resource($data)) {
806 806
             // We've got stream data
807 807
             $stat = @fstat($data);
808
-            if($stat) {
808
+            if ($stat) {
809 809
                 $this->setHeaders(self::CONTENT_LENGTH, $stat['size']);
810 810
             }
811 811
         }
@@ -862,7 +862,7 @@  discard block
 block discarded – undo
862 862
         $this->raw_post_data = null;
863 863
         $this->enctype       = null;
864 864
 
865
-        if($clearAll) {
865
+        if ($clearAll) {
866 866
             $this->headers = array();
867 867
             $this->last_request = null;
868 868
             $this->last_response = null;
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
             $adapter = new $adapter;
927 927
         }
928 928
 
929
-        if (! $adapter instanceof Zend_Http_Client_Adapter_Interface) {
929
+        if (!$adapter instanceof Zend_Http_Client_Adapter_Interface) {
930 930
             /** @see Zend_Http_Client_Exception */
931 931
             require_once 'Zend/Http/Client/Exception.php';
932 932
             throw new Zend_Http_Client_Exception('Passed adapter is not a HTTP connection adapter');
@@ -981,9 +981,9 @@  discard block
 block discarded – undo
981 981
     protected function _openTempStream()
982 982
     {
983 983
         $this->_stream_name = $this->config['output_stream'];
984
-        if(!is_string($this->_stream_name)) {
984
+        if (!is_string($this->_stream_name)) {
985 985
             // If name is not given, create temp name
986
-            $this->_stream_name = tempnam(isset($this->config['stream_tmp_dir'])?$this->config['stream_tmp_dir']:sys_get_temp_dir(),
986
+            $this->_stream_name = tempnam(isset($this->config['stream_tmp_dir']) ? $this->config['stream_tmp_dir'] : sys_get_temp_dir(),
987 987
                  'Zend_Http_Client');
988 988
         }
989 989
 
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
      */
1008 1008
     public function request($method = null)
1009 1009
     {
1010
-        if (! $this->uri instanceof Zend_Uri_Http) {
1010
+        if (!$this->uri instanceof Zend_Uri_Http) {
1011 1011
             /** @see Zend_Http_Client_Exception */
1012 1012
             require_once 'Zend/Http/Client/Exception.php';
1013 1013
             throw new Zend_Http_Client_Exception('No valid URI has been passed to the client');
@@ -1028,9 +1028,9 @@  discard block
 block discarded – undo
1028 1028
         do {
1029 1029
             // Clone the URI and add the additional GET parameters to it
1030 1030
             $uri = clone $this->uri;
1031
-            if (! empty($this->paramsGet)) {
1031
+            if (!empty($this->paramsGet)) {
1032 1032
                 $query = $uri->getQuery();
1033
-                   if (! empty($query)) {
1033
+                   if (!empty($query)) {
1034 1034
                        $query .= '&';
1035 1035
                    }
1036 1036
                 $query .= http_build_query($this->paramsGet, null, '&');
@@ -1054,7 +1054,7 @@  discard block
 block discarded – undo
1054 1054
             $headers = $this->_prepareHeaders();
1055 1055
 
1056 1056
             // check that adapter supports streaming before using it
1057
-            if(is_resource($body) && !($this->adapter instanceof Zend_Http_Client_Adapter_Stream)) {
1057
+            if (is_resource($body) && !($this->adapter instanceof Zend_Http_Client_Adapter_Stream)) {
1058 1058
                 /** @see Zend_Http_Client_Exception */
1059 1059
                 require_once 'Zend/Http/Client/Exception.php';
1060 1060
                 throw new Zend_Http_Client_Exception('Adapter does not support streaming');
@@ -1064,8 +1064,8 @@  discard block
 block discarded – undo
1064 1064
             $this->adapter->connect($uri->getHost(), $uri->getPort(),
1065 1065
                 ($uri->getScheme() == 'https' ? true : false));
1066 1066
 
1067
-            if($this->config['output_stream']) {
1068
-                if($this->adapter instanceof Zend_Http_Client_Adapter_Stream) {
1067
+            if ($this->config['output_stream']) {
1068
+                if ($this->adapter instanceof Zend_Http_Client_Adapter_Stream) {
1069 1069
                     $stream = $this->_openTempStream();
1070 1070
                     $this->adapter->setOutputStream($stream);
1071 1071
                 } else {
@@ -1079,13 +1079,13 @@  discard block
 block discarded – undo
1079 1079
                 $uri, $this->config['httpversion'], $headers, $body);
1080 1080
 
1081 1081
             $response = $this->adapter->read();
1082
-            if (! $response) {
1082
+            if (!$response) {
1083 1083
                 /** @see Zend_Http_Client_Exception */
1084 1084
                 require_once 'Zend/Http/Client/Exception.php';
1085 1085
                 throw new Zend_Http_Client_Exception('Unable to read response, or response is empty');
1086 1086
             }
1087 1087
 
1088
-            if($this->config['output_stream']) {
1088
+            if ($this->config['output_stream']) {
1089 1089
                 $streamMetaData = stream_get_meta_data($stream);
1090 1090
                 if ($streamMetaData['seekable']) {
1091 1091
                     rewind($stream);
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
                 $this->adapter->setOutputStream(null);
1095 1095
                 $response = Zend_Http_Response_Stream::fromStream($response, $stream);
1096 1096
                 $response->setStreamName($this->_stream_name);
1097
-                if(!is_string($this->config['output_stream'])) {
1097
+                if (!is_string($this->config['output_stream'])) {
1098 1098
                     // we used temp name, will need to clean up
1099 1099
                     $response->setCleanup(true);
1100 1100
                 }
@@ -1121,7 +1121,7 @@  discard block
 block discarded – undo
1121 1121
                 // Check whether we send the exact same request again, or drop the parameters
1122 1122
                 // and send a GET request
1123 1123
                 if ($response->getStatus() == 303 ||
1124
-                   ((! $this->config['strictredirects']) && ($response->getStatus() == 302 ||
1124
+                   ((!$this->config['strictredirects']) && ($response->getStatus() == 302 ||
1125 1125
                        $response->getStatus() == 301))) {
1126 1126
 
1127 1127
                     $this->resetParameters();
@@ -1144,7 +1144,7 @@  discard block
 block discarded – undo
1144 1144
                     $this->uri->setQuery($query);
1145 1145
 
1146 1146
                     // Else, if we got just an absolute path, set it
1147
-                    if(strpos($location, '/') === 0) {
1147
+                    if (strpos($location, '/') === 0) {
1148 1148
                         $this->uri->setPath($location);
1149 1149
 
1150 1150
                         // Else, assume we have a relative path
@@ -1177,11 +1177,11 @@  discard block
 block discarded – undo
1177 1177
         $headers = array();
1178 1178
 
1179 1179
         // Set the host header
1180
-        if (! isset($this->headers['host'])) {
1180
+        if (!isset($this->headers['host'])) {
1181 1181
             $host = $this->uri->getHost();
1182 1182
 
1183 1183
             // If the port is not default, add it
1184
-            if (! (($this->uri->getScheme() == 'http' && $this->uri->getPort() == 80) ||
1184
+            if (!(($this->uri->getScheme() == 'http' && $this->uri->getPort() == 80) ||
1185 1185
                   ($this->uri->getScheme() == 'https' && $this->uri->getPort() == 443))) {
1186 1186
                 $host .= ':' . $this->uri->getPort();
1187 1187
             }
@@ -1190,15 +1190,15 @@  discard block
 block discarded – undo
1190 1190
         }
1191 1191
 
1192 1192
         // Set the connection header
1193
-        if (! isset($this->headers['connection'])) {
1194
-            if (! $this->config['keepalive']) {
1193
+        if (!isset($this->headers['connection'])) {
1194
+            if (!$this->config['keepalive']) {
1195 1195
                 $headers[] = "Connection: close";
1196 1196
             }
1197 1197
         }
1198 1198
 
1199 1199
         // Set the Accept-encoding header if not set - depending on whether
1200 1200
         // zlib is available or not.
1201
-        if (! isset($this->headers['accept-encoding'])) {
1201
+        if (!isset($this->headers['accept-encoding'])) {
1202 1202
             if (function_exists('gzinflate')) {
1203 1203
                 $headers[] = 'Accept-encoding: gzip, deflate';
1204 1204
             } else {
@@ -1208,13 +1208,13 @@  discard block
 block discarded – undo
1208 1208
 
1209 1209
         // Set the Content-Type header
1210 1210
         if (($this->method == self::POST || $this->method == self::PUT) &&
1211
-           (! isset($this->headers[strtolower(self::CONTENT_TYPE)]) && isset($this->enctype))) {
1211
+           (!isset($this->headers[strtolower(self::CONTENT_TYPE)]) && isset($this->enctype))) {
1212 1212
 
1213 1213
             $headers[] = self::CONTENT_TYPE . ': ' . $this->enctype;
1214 1214
         }
1215 1215
 
1216 1216
         // Set the user agent header
1217
-        if (! isset($this->headers['user-agent']) && isset($this->config['useragent'])) {
1217
+        if (!isset($this->headers['user-agent']) && isset($this->config['useragent'])) {
1218 1218
             $headers[] = "User-Agent: {$this->config['useragent']}";
1219 1219
         }
1220 1220
 
@@ -1266,7 +1266,7 @@  discard block
 block discarded – undo
1266 1266
         // If mbstring overloads substr and strlen functions, we have to
1267 1267
         // override it's internal encoding
1268 1268
         if (function_exists('mb_internal_encoding') &&
1269
-           ((int) ini_get('mbstring.func_overload')) & 2) {
1269
+           ((int)ini_get('mbstring.func_overload')) & 2) {
1270 1270
 
1271 1271
             $mbIntEnc = mb_internal_encoding();
1272 1272
             mb_internal_encoding('ASCII');
@@ -1285,13 +1285,13 @@  discard block
 block discarded – undo
1285 1285
         $body = '';
1286 1286
 
1287 1287
         // If we have files to upload, force enctype to multipart/form-data
1288
-        if (count ($this->files) > 0) {
1288
+        if (count($this->files) > 0) {
1289 1289
             $this->setEncType(self::ENC_FORMDATA);
1290 1290
         }
1291 1291
 
1292 1292
         // If we have POST parameters or files, encode and add them to the body
1293 1293
         if (count($this->paramsPost) > 0 || count($this->files) > 0) {
1294
-            switch($this->enctype) {
1294
+            switch ($this->enctype) {
1295 1295
                 case self::ENC_FORMDATA:
1296 1296
                     // Encode body as multipart/form-data
1297 1297
                     $boundary = '---ZENDHTTPCLIENT-' . md5(microtime());
@@ -1302,7 +1302,7 @@  discard block
 block discarded – undo
1302 1302
                         switch ($fieldType) {
1303 1303
                             case self::VTYPE_FILE:
1304 1304
                                 foreach ($this->files as $file) {
1305
-                                    if ($file['formname']===$fieldName) {
1305
+                                    if ($file['formname'] === $fieldName) {
1306 1306
                                         $fhead = array(self::CONTENT_TYPE => $file['ctype']);
1307 1307
                                         $body .= self::encodeFormData($boundary, $file['formname'], $file['data'], $file['filename'], $fhead);
1308 1308
                                     }
@@ -1377,10 +1377,10 @@  discard block
 block discarded – undo
1377 1377
     protected function _getParametersRecursive($parray, $urlencode = false)
1378 1378
     {
1379 1379
         // Issue a deprecated notice
1380
-        trigger_error("The " .  __METHOD__ . " method is deprecated and will be dropped in 2.0.",
1380
+        trigger_error("The " . __METHOD__ . " method is deprecated and will be dropped in 2.0.",
1381 1381
             E_USER_NOTICE);
1382 1382
 
1383
-        if (! is_array($parray)) {
1383
+        if (!is_array($parray)) {
1384 1384
             return $parray;
1385 1385
         }
1386 1386
         $parameters = array();
@@ -1443,7 +1443,7 @@  discard block
 block discarded – undo
1443 1443
         }
1444 1444
 
1445 1445
         // Fallback to the default application/octet-stream
1446
-        if (! $type) {
1446
+        if (!$type) {
1447 1447
             $type = 'application/octet-stream';
1448 1448
         }
1449 1449
 
@@ -1463,7 +1463,7 @@  discard block
 block discarded – undo
1463 1463
     public static function encodeFormData($boundary, $name, $value, $filename = null, $headers = array())
1464 1464
     {
1465 1465
         $ret = "--{$boundary}\r\n" .
1466
-            'Content-Disposition: form-data; name="' . $name .'"';
1466
+            'Content-Disposition: form-data; name="' . $name . '"';
1467 1467
 
1468 1468
         if ($filename) {
1469 1469
             $ret .= '; filename="' . $filename . '"';
@@ -1538,13 +1538,13 @@  discard block
 block discarded – undo
1538 1538
      */
1539 1539
     protected static function _flattenParametersArray($parray, $prefix = null)
1540 1540
     {
1541
-        if (! is_array($parray)) {
1541
+        if (!is_array($parray)) {
1542 1542
             return $parray;
1543 1543
         }
1544 1544
 
1545 1545
         $parameters = array();
1546 1546
 
1547
-        foreach($parray as $name => $value) {
1547
+        foreach ($parray as $name => $value) {
1548 1548
 
1549 1549
             // Calculate array key
1550 1550
             if ($prefix) {
Please login to merge, or discard this patch.
lib/Zend/Validate/Hostname.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
85 85
     /**
86 86
      * Allows Internet domain names (e.g., example.com)
87 87
      */
88
-    const ALLOW_DNS   = 1;
88
+    const ALLOW_DNS = 1;
89 89
 
90 90
     /**
91 91
      * Allows IP addresses
92 92
      */
93
-    const ALLOW_IP    = 2;
93
+    const ALLOW_IP = 2;
94 94
 
95 95
     /**
96 96
      * Allows local network names (e.g., localhost, www.localdomain)
@@ -1089,9 +1089,9 @@  discard block
 block discarded – undo
1089 1089
      *
1090 1090
      * @param boolean $allowed Set allowed to true to validate IDNs, and false to not validate them
1091 1091
      */
1092
-    public function setValidateIdn ($allowed)
1092
+    public function setValidateIdn($allowed)
1093 1093
     {
1094
-        $this->_options['idn'] = (bool) $allowed;
1094
+        $this->_options['idn'] = (bool)$allowed;
1095 1095
         return $this;
1096 1096
     }
1097 1097
 
@@ -1112,9 +1112,9 @@  discard block
 block discarded – undo
1112 1112
      *
1113 1113
      * @param boolean $allowed Set allowed to true to validate TLDs, and false to not validate them
1114 1114
      */
1115
-    public function setValidateTld ($allowed)
1115
+    public function setValidateTld($allowed)
1116 1116
     {
1117
-        $this->_options['tld'] = (bool) $allowed;
1117
+        $this->_options['tld'] = (bool)$allowed;
1118 1118
         return $this;
1119 1119
     }
1120 1120
 
@@ -1217,7 +1217,7 @@  discard block
 block discarded – undo
1217 1217
                      * @see Zend_Validate_Hostname_Interface
1218 1218
                      */
1219 1219
                     $regexChars = array(0 => '/^[a-z0-9\x2d]{1,63}$/i');
1220
-                    if ($this->_options['idn'] &&  isset($this->_validIdns[strtoupper($this->_tld)])) {
1220
+                    if ($this->_options['idn'] && isset($this->_validIdns[strtoupper($this->_tld)])) {
1221 1221
                         if (is_string($this->_validIdns[strtoupper($this->_tld)])) {
1222 1222
                             $regexChars += include($this->_validIdns[strtoupper($this->_tld)]);
1223 1223
                         } else {
@@ -1253,7 +1253,7 @@  discard block
 block discarded – undo
1253 1253
 
1254 1254
                         // Check each domain part
1255 1255
                         $checked = false;
1256
-                        foreach($regexChars as $regexKey => $regexChar) {
1256
+                        foreach ($regexChars as $regexKey => $regexChar) {
1257 1257
                             $status = @preg_match($regexChar, $domainPart);
1258 1258
                             if ($status > 0) {
1259 1259
                                 $length = 63;
@@ -1369,7 +1369,7 @@  discard block
 block discarded – undo
1369 1369
         $char  = 0x80;
1370 1370
 
1371 1371
         for ($indexe = ($separator) ? ($separator + 1) : 0; $indexe < $lengthe; ++$lengthd) {
1372
-            for ($old_index = $index, $pos = 1, $key = 36; 1 ; $key += 36) {
1372
+            for ($old_index = $index, $pos = 1, $key = 36; 1; $key += 36) {
1373 1373
                 $hex   = ord($encoded[$indexe++]);
1374 1374
                 $digit = ($hex - 48 < 10) ? $hex - 22
1375 1375
                        : (($hex - 65 < 26) ? $hex - 65
@@ -1382,7 +1382,7 @@  discard block
 block discarded – undo
1382 1382
                     break;
1383 1383
                 }
1384 1384
 
1385
-                $pos = (int) ($pos * (36 - $tag));
1385
+                $pos = (int)($pos * (36 - $tag));
1386 1386
             }
1387 1387
 
1388 1388
             $delta   = intval($init ? (($index - $old_index) / 700) : (($index - $old_index) / 2));
@@ -1393,7 +1393,7 @@  discard block
 block discarded – undo
1393 1393
 
1394 1394
             $base   = intval($key + 36 * $delta / ($delta + 38));
1395 1395
             $init   = false;
1396
-            $char  += (int) ($index / ($lengthd + 1));
1396
+            $char  += (int)($index / ($lengthd + 1));
1397 1397
             $index %= ($lengthd + 1);
1398 1398
             if ($lengthd > 0) {
1399 1399
                 for ($i = $lengthd; $i > $index; $i--) {
Please login to merge, or discard this patch.
lib/Zend/Validate/Ip.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
     public function setOptions($options)
98 98
     {
99 99
         if (array_key_exists('allowipv6', $options)) {
100
-            $this->_options['allowipv6'] = (boolean) $options['allowipv6'];
100
+            $this->_options['allowipv6'] = (boolean)$options['allowipv6'];
101 101
         }
102 102
 
103 103
         if (array_key_exists('allowipv4', $options)) {
104
-            $this->_options['allowipv4'] = (boolean) $options['allowipv4'];
104
+            $this->_options['allowipv4'] = (boolean)$options['allowipv4'];
105 105
         }
106 106
 
107 107
         if (!$this->_options['allowipv4'] && !$this->_options['allowipv6']) {
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
      */
146 146
     protected function _validateIPv4($value) {
147 147
         $ip2long = ip2long($value);
148
-        if($ip2long === false) {
148
+        if ($ip2long === false) {
149 149
             return false;
150 150
         }
151 151
 
Please login to merge, or discard this patch.
lib/Zend/Validate/Abstract.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
     {
143 143
         if ($messageKey === null) {
144 144
             $keys = array_keys($this->_messageTemplates);
145
-            foreach($keys as $key) {
145
+            foreach ($keys as $key) {
146 146
                 $this->setMessage($messageString, $key);
147 147
             }
148 148
             return $this;
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
         } elseif (is_array($value)) {
233 233
             $value = $this->_implodeRecursive($value);
234 234
         } else {
235
-            $value = implode((array) $value);
235
+            $value = implode((array)$value);
236 236
         }
237 237
 
238 238
         if ($this->getObscureValue()) {
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
         foreach ($this->_messageVariables as $ident => $property) {
244 244
             $message = str_replace(
245 245
                 "%$ident%",
246
-                implode(' ', (array) $this->$property),
246
+                implode(' ', (array)$this->$property),
247 247
                 $message
248 248
             );
249 249
         }
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
      */
327 327
     public function setObscureValue($flag)
328 328
     {
329
-        $this->_obscureValue = (bool) $flag;
329
+        $this->_obscureValue = (bool)$flag;
330 330
         return $this;
331 331
     }
332 332
 
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
      */
447 447
     public function setDisableTranslator($flag)
448 448
     {
449
-        $this->_translatorDisabled = (bool) $flag;
449
+        $this->_translatorDisabled = (bool)$flag;
450 450
         return $this;
451 451
     }
452 452
 
Please login to merge, or discard this patch.