Completed
Pull Request — master (#54)
by Reginaldo
41:52
created
lib/Cake/Network/Email/SmtpTransport.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
  * Send mail
51 51
  *
52 52
  * @param CakeEmail $email CakeEmail
53
- * @return array
53
+ * @return string
54 54
  * @throws SocketException
55 55
  */
56 56
 	public function send(CakeEmail $email) {
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
  */
97 97
 	protected function _connect() {
98 98
 		$this->_generateSocket();
99
-		if (!$this->_socket->connect()) {
99
+		if ( ! $this->_socket->connect()) {
100 100
 			throw new SocketException(__d('cake_dev', 'Unable to connect to SMTP server.'));
101 101
 		}
102 102
 		$this->_smtpSend(null, '220');
@@ -138,10 +138,10 @@  discard block
 block discarded – undo
138 138
 		if (isset($this->_config['username']) && isset($this->_config['password'])) {
139 139
 			$authRequired = $this->_smtpSend('AUTH LOGIN', '334|503');
140 140
 			if ($authRequired == '334') {
141
-				if (!$this->_smtpSend(base64_encode($this->_config['username']), '334')) {
141
+				if ( ! $this->_smtpSend(base64_encode($this->_config['username']), '334')) {
142 142
 					throw new SocketException(__d('cake_dev', 'SMTP server did not accept the username.'));
143 143
 				}
144
-				if (!$this->_smtpSend(base64_encode($this->_config['password']), '235')) {
144
+				if ( ! $this->_smtpSend(base64_encode($this->_config['password']), '235')) {
145 145
 					throw new SocketException(__d('cake_dev', 'SMTP server did not accept the password.'));
146 146
 				}
147 147
 			} elseif ($authRequired == '504') {
@@ -163,14 +163,14 @@  discard block
 block discarded – undo
163 163
 		if (empty($from)) {
164 164
 			$from = $this->_cakeEmail->from();
165 165
 		}
166
-		$this->_smtpSend('MAIL FROM:<' . key($from) . '>');
166
+		$this->_smtpSend('MAIL FROM:<'.key($from).'>');
167 167
 
168 168
 		$to = $this->_cakeEmail->to();
169 169
 		$cc = $this->_cakeEmail->cc();
170 170
 		$bcc = $this->_cakeEmail->bcc();
171 171
 		$emails = array_merge(array_keys($to), array_keys($cc), array_keys($bcc));
172 172
 		foreach ($emails as $email) {
173
-			$this->_smtpSend('RCPT TO:<' . $email . '>');
173
+			$this->_smtpSend('RCPT TO:<'.$email.'>');
174 174
 		}
175 175
 	}
176 176
 
@@ -188,14 +188,14 @@  discard block
 block discarded – undo
188 188
 		$lines = $this->_cakeEmail->message();
189 189
 		$messages = array();
190 190
 		foreach ($lines as $line) {
191
-			if ((!empty($line)) && ($line[0] === '.')) {
192
-				$messages[] = '.' . $line;
191
+			if (( ! empty($line)) && ($line[0] === '.')) {
192
+				$messages[] = '.'.$line;
193 193
 			} else {
194 194
 				$messages[] = $line;
195 195
 			}
196 196
 		}
197 197
 		$message = implode("\r\n", $messages);
198
-		$this->_smtpSend($headers . "\r\n\r\n" . $message . "\r\n\r\n\r\n.");
198
+		$this->_smtpSend($headers."\r\n\r\n".$message."\r\n\r\n\r\n.");
199 199
 		$this->_content = array('headers' => $headers, 'message' => $message);
200 200
 	}
201 201
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
  */
231 231
 	protected function _smtpSend($data, $checkCode = '250') {
232 232
 		if ($data !== null) {
233
-			$this->_socket->write($data . "\r\n");
233
+			$this->_socket->write($data."\r\n");
234 234
 		}
235 235
 		while ($checkCode !== false) {
236 236
 			$response = '';
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 			$responseLines = explode("\r\n", rtrim($response, "\r\n"));
245 245
 			$response = end($responseLines);
246 246
 
247
-			if (preg_match('/^(' . $checkCode . ')(.)/', $response, $code)) {
247
+			if (preg_match('/^('.$checkCode.')(.)/', $response, $code)) {
248 248
 				if ($code[2] === '-') {
249 249
 					continue;
250 250
 				}
Please login to merge, or discard this patch.
lib/Cake/Network/Http/HttpSocket.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
  *
546 546
  * @param string|array Either a string or array of URL options to create a URL with.
547 547
  * @param string $uriTemplate A template string to use for URL formatting.
548
- * @return mixed Either false on failure or a string containing the composed URL.
548
+ * @return false|string Either false on failure or a string containing the composed URL.
549 549
  */
550 550
 	public function url($url = null, $uriTemplate = null) {
551 551
 		if ($url === null) {
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
  *
699 699
  * @param string|array $uri Either A $uri array, or a request string. Will use $this->config if left empty.
700 700
  * @param string $uriTemplate The Uri template/format to use.
701
- * @return mixed A fully qualified URL formatted according to $uriTemplate, or false on failure
701
+ * @return false|string A fully qualified URL formatted according to $uriTemplate, or false on failure
702 702
  */
703 703
 	protected function _buildUri($uri = array(), $uriTemplate = '%scheme://%user:%pass@%host:%port/%path?%query#%fragment') {
704 704
 		if (is_string($uri)) {
Please login to merge, or discard this patch.
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 			$this->_contentResource = null;
241 241
 			return;
242 242
 		}
243
-		if (!is_resource($resource)) {
243
+		if ( ! is_resource($resource)) {
244 244
 			throw new SocketException(__d('cake_dev', 'Invalid resource.'));
245 245
 		}
246 246
 		$this->_contentResource = $resource;
@@ -259,15 +259,15 @@  discard block
 block discarded – undo
259 259
 
260 260
 		if (is_string($request)) {
261 261
 			$request = array('uri' => $request);
262
-		} elseif (!is_array($request)) {
262
+		} elseif ( ! is_array($request)) {
263 263
 			return false;
264 264
 		}
265 265
 
266
-		if (!isset($request['uri'])) {
266
+		if ( ! isset($request['uri'])) {
267 267
 			$request['uri'] = null;
268 268
 		}
269 269
 		$uri = $this->_parseUri($request['uri']);
270
-		if (!isset($uri['host'])) {
270
+		if ( ! isset($uri['host'])) {
271 271
 			$host = $this->config['host'];
272 272
 		}
273 273
 		if (isset($request['host'])) {
@@ -281,11 +281,11 @@  discard block
 block discarded – undo
281 281
 		$this->_configUri($this->request['uri']);
282 282
 
283 283
 		$Host = $this->request['uri']['host'];
284
-		if (!empty($this->config['request']['cookies'][$Host])) {
285
-			if (!isset($this->request['cookies'])) {
284
+		if ( ! empty($this->config['request']['cookies'][$Host])) {
285
+			if ( ! isset($this->request['cookies'])) {
286 286
 				$this->request['cookies'] = array();
287 287
 			}
288
-			if (!isset($request['cookies'])) {
288
+			if ( ! isset($request['cookies'])) {
289 289
 				$request['cookies'] = array();
290 290
 			}
291 291
 			$this->request['cookies'] = array_merge($this->request['cookies'], $this->config['request']['cookies'][$Host], $request['cookies']);
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 		$cookies = null;
301 301
 
302 302
 		if (is_array($this->request['header'])) {
303
-			if (!empty($this->request['cookies'])) {
303
+			if ( ! empty($this->request['cookies'])) {
304 304
 				$cookies = $this->buildCookies($this->request['cookies']);
305 305
 			}
306 306
 			$scheme = '';
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 				($scheme === 'https' && $port != 443) ||
317 317
 				($port != 80 && $port != 443)
318 318
 			) {
319
-				$Host .= ':' . $port;
319
+				$Host .= ':'.$port;
320 320
 			}
321 321
 			$this->request['header'] = array_merge(compact('Host'), $this->request['header']);
322 322
 		}
@@ -333,11 +333,11 @@  discard block
 block discarded – undo
333 333
 			$this->request['body'] = http_build_query($this->request['body'], '', '&');
334 334
 		}
335 335
 
336
-		if (!empty($this->request['body']) && !isset($this->request['header']['Content-Type'])) {
336
+		if ( ! empty($this->request['body']) && ! isset($this->request['header']['Content-Type'])) {
337 337
 			$this->request['header']['Content-Type'] = 'application/x-www-form-urlencoded';
338 338
 		}
339 339
 
340
-		if (!empty($this->request['body']) && !isset($this->request['header']['Content-Length'])) {
340
+		if ( ! empty($this->request['body']) && ! isset($this->request['header']['Content-Length'])) {
341 341
 			$this->request['header']['Content-Length'] = strlen($this->request['body']);
342 342
 		}
343 343
 
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 		if (isset($this->request['header']['Connection'])) {
346 346
 			$connectionType = $this->request['header']['Connection'];
347 347
 		}
348
-		$this->request['header'] = $this->_buildHeader($this->request['header']) . $cookies;
348
+		$this->request['header'] = $this->_buildHeader($this->request['header']).$cookies;
349 349
 
350 350
 		if (empty($this->request['line'])) {
351 351
 			$this->request['line'] = $this->_buildRequestLine($this->request);
@@ -399,14 +399,14 @@  discard block
 block discarded – undo
399 399
 		}
400 400
 
401 401
 		list($plugin, $responseClass) = pluginSplit($this->responseClass, true);
402
-		App::uses($responseClass, $plugin . 'Network/Http');
403
-		if (!class_exists($responseClass)) {
402
+		App::uses($responseClass, $plugin.'Network/Http');
403
+		if ( ! class_exists($responseClass)) {
404 404
 			throw new SocketException(__d('cake_dev', 'Class %s not found.', $this->responseClass));
405 405
 		}
406 406
 		$this->response = new $responseClass($response);
407 407
 
408
-		if (!empty($this->response->cookies)) {
409
-			if (!isset($this->config['request']['cookies'][$Host])) {
408
+		if ( ! empty($this->response->cookies)) {
409
+			if ( ! isset($this->config['request']['cookies'][$Host])) {
410 410
 				$this->config['request']['cookies'][$Host] = array();
411 411
 			}
412 412
 			$this->config['request']['cookies'][$Host] = array_merge($this->config['request']['cookies'][$Host], $this->response->cookies);
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
  * @return mixed Result of request, either false on failure or the response to the request.
446 446
  */
447 447
 	public function get($uri = null, $query = array(), $request = array()) {
448
-		if (!empty($query)) {
448
+		if ( ! empty($query)) {
449 449
 			$uri = $this->_parseUri($uri, $this->config['request']['uri']);
450 450
 			if (isset($uri['query'])) {
451 451
 				$uri['query'] = array_merge($uri['query'], $query);
@@ -561,12 +561,12 @@  discard block
 block discarded – undo
561 561
 				$port = $port[0];
562 562
 			}
563 563
 			if ($url{0} === '/') {
564
-				$url = $this->config['request']['uri']['host'] . ':' . $port . $url;
564
+				$url = $this->config['request']['uri']['host'].':'.$port.$url;
565 565
 			}
566
-			if (!preg_match('/^.+:\/\/|\*|^\//', $url)) {
567
-				$url = $scheme . '://' . $url;
566
+			if ( ! preg_match('/^.+:\/\/|\*|^\//', $url)) {
567
+				$url = $scheme.'://'.$url;
568 568
 			}
569
-		} elseif (!is_array($url) && !empty($url)) {
569
+		} elseif ( ! is_array($url) && ! empty($url)) {
570 570
 			return false;
571 571
 		}
572 572
 
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 			$url = $this->config['request']['uri'];
578 578
 		}
579 579
 
580
-		if (!empty($uriTemplate)) {
580
+		if ( ! empty($uriTemplate)) {
581 581
 			return $this->_buildUri($url, $uriTemplate);
582 582
 		}
583 583
 		return $this->_buildUri($url);
@@ -595,13 +595,13 @@  discard block
 block discarded – undo
595 595
 		}
596 596
 		$method = key($this->_auth);
597 597
 		list($plugin, $authClass) = pluginSplit($method, true);
598
-		$authClass = Inflector::camelize($authClass) . 'Authentication';
599
-		App::uses($authClass, $plugin . 'Network/Http');
598
+		$authClass = Inflector::camelize($authClass).'Authentication';
599
+		App::uses($authClass, $plugin.'Network/Http');
600 600
 
601
-		if (!class_exists($authClass)) {
601
+		if ( ! class_exists($authClass)) {
602 602
 			throw new SocketException(__d('cake_dev', 'Unknown authentication method.'));
603 603
 		}
604
-		if (!method_exists($authClass, 'authentication')) {
604
+		if ( ! method_exists($authClass, 'authentication')) {
605 605
 			throw new SocketException(__d('cake_dev', 'The %s does not support authentication.', $authClass));
606 606
 		}
607 607
 		call_user_func_array("$authClass::authentication", array($this, &$this->_auth[$method]));
@@ -614,23 +614,23 @@  discard block
 block discarded – undo
614 614
  * @throws SocketException
615 615
  */
616 616
 	protected function _setProxy() {
617
-		if (empty($this->_proxy) || !isset($this->_proxy['host'], $this->_proxy['port'])) {
617
+		if (empty($this->_proxy) || ! isset($this->_proxy['host'], $this->_proxy['port'])) {
618 618
 			return;
619 619
 		}
620 620
 		$this->config['host'] = $this->_proxy['host'];
621 621
 		$this->config['port'] = $this->_proxy['port'];
622 622
 
623
-		if (empty($this->_proxy['method']) || !isset($this->_proxy['user'], $this->_proxy['pass'])) {
623
+		if (empty($this->_proxy['method']) || ! isset($this->_proxy['user'], $this->_proxy['pass'])) {
624 624
 			return;
625 625
 		}
626 626
 		list($plugin, $authClass) = pluginSplit($this->_proxy['method'], true);
627
-		$authClass = Inflector::camelize($authClass) . 'Authentication';
628
-		App::uses($authClass, $plugin . 'Network/Http');
627
+		$authClass = Inflector::camelize($authClass).'Authentication';
628
+		App::uses($authClass, $plugin.'Network/Http');
629 629
 
630
-		if (!class_exists($authClass)) {
630
+		if ( ! class_exists($authClass)) {
631 631
 			throw new SocketException(__d('cake_dev', 'Unknown authentication method for proxy.'));
632 632
 		}
633
-		if (!method_exists($authClass, 'proxyAuthentication')) {
633
+		if ( ! method_exists($authClass, 'proxyAuthentication')) {
634 634
 			throw new SocketException(__d('cake_dev', 'The %s does not support proxy authentication.', $authClass));
635 635
 		}
636 636
 		call_user_func_array("$authClass::proxyAuthentication", array($this, &$this->_proxy));
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 			$uri = $this->_parseUri($uri, true);
654 654
 		}
655 655
 
656
-		if (!isset($uri['host'])) {
656
+		if ( ! isset($uri['host'])) {
657 657
 			return false;
658 658
 		}
659 659
 		$config = array(
@@ -685,9 +685,9 @@  discard block
 block discarded – undo
685 685
 			unset($this->config[$key]);
686 686
 		}
687 687
 		if (empty($this->config['context']['ssl']['cafile'])) {
688
-			$this->config['context']['ssl']['cafile'] = CAKE . 'Config' . DS . 'cacert.pem';
688
+			$this->config['context']['ssl']['cafile'] = CAKE.'Config'.DS.'cacert.pem';
689 689
 		}
690
-		if (!empty($this->config['context']['ssl']['verify_host'])) {
690
+		if ( ! empty($this->config['context']['ssl']['verify_host'])) {
691 691
 			$this->config['context']['ssl']['CN_match'] = $host;
692 692
 		}
693 693
 		unset($this->config['context']['ssl']['verify_host']);
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
 		}
707 707
 		$uri = $this->_parseUri($uri, true);
708 708
 
709
-		if (!is_array($uri) || empty($uri)) {
709
+		if ( ! is_array($uri) || empty($uri)) {
710 710
 			return false;
711 711
 		}
712 712
 
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
 			$uriTemplate = str_replace(':%port', null, $uriTemplate);
732 732
 		}
733 733
 		foreach ($uri as $property => $value) {
734
-			$uriTemplate = str_replace('%' . $property, $value, $uriTemplate);
734
+			$uriTemplate = str_replace('%'.$property, $value, $uriTemplate);
735 735
 		}
736 736
 
737 737
 		if ($uriTemplate === '/*') {
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
 		if (is_string($uri)) {
764 764
 			$uri = parse_url($uri);
765 765
 		}
766
-		if (!is_array($uri) || empty($uri)) {
766
+		if ( ! is_array($uri) || empty($uri)) {
767 767
 			return false;
768 768
 		}
769 769
 		if ($base === true) {
@@ -771,14 +771,14 @@  discard block
 block discarded – undo
771 771
 		}
772 772
 
773 773
 		if (isset($base['port'], $base['scheme']) && is_array($base['port']) && is_array($base['scheme'])) {
774
-			if (isset($uri['scheme']) && !isset($uri['port'])) {
774
+			if (isset($uri['scheme']) && ! isset($uri['port'])) {
775 775
 				$base['port'] = $base['port'][array_search($uri['scheme'], $base['scheme'])];
776
-			} elseif (isset($uri['port']) && !isset($uri['scheme'])) {
776
+			} elseif (isset($uri['port']) && ! isset($uri['scheme'])) {
777 777
 				$base['scheme'] = $base['scheme'][array_search($uri['port'], $base['port'])];
778 778
 			}
779 779
 		}
780 780
 
781
-		if (is_array($base) && !empty($base)) {
781
+		if (is_array($base) && ! empty($base)) {
782 782
 			$uri = array_merge($base, $uri);
783 783
 		}
784 784
 
@@ -793,7 +793,7 @@  discard block
 block discarded – undo
793 793
 			$uri['query'] = $this->_parseQuery($uri['query']);
794 794
 		}
795 795
 
796
-		if (!array_intersect_key($uriBase, $uri)) {
796
+		if ( ! array_intersect_key($uriBase, $uri)) {
797 797
 			return false;
798 798
 		}
799 799
 		return $uri;
@@ -820,7 +820,7 @@  discard block
 block discarded – undo
820 820
 
821 821
 		$parsedQuery = array();
822 822
 
823
-		if (is_string($query) && !empty($query)) {
823
+		if (is_string($query) && ! empty($query)) {
824 824
 			$query = preg_replace('/^\?/', '', $query);
825 825
 			$items = explode('&', $query);
826 826
 
@@ -838,13 +838,13 @@  discard block
 block discarded – undo
838 838
 				if (preg_match_all('/\[([^\[\]]*)\]/iUs', $key, $matches)) {
839 839
 					$subKeys = $matches[1];
840 840
 					$rootKey = substr($key, 0, strpos($key, '['));
841
-					if (!empty($rootKey)) {
841
+					if ( ! empty($rootKey)) {
842 842
 						array_unshift($subKeys, $rootKey);
843 843
 					}
844
-					$queryNode =& $parsedQuery;
844
+					$queryNode = & $parsedQuery;
845 845
 
846 846
 					foreach ($subKeys as $subKey) {
847
-						if (!is_array($queryNode)) {
847
+						if ( ! is_array($queryNode)) {
848 848
 							$queryNode = array();
849 849
 						}
850 850
 
@@ -853,15 +853,15 @@  discard block
 block discarded – undo
853 853
 							end($queryNode);
854 854
 							$subKey = key($queryNode);
855 855
 						}
856
-						$queryNode =& $queryNode[$subKey];
856
+						$queryNode = & $queryNode[$subKey];
857 857
 					}
858 858
 					$queryNode = $value;
859 859
 					continue;
860 860
 				}
861
-				if (!isset($parsedQuery[$key])) {
861
+				if ( ! isset($parsedQuery[$key])) {
862 862
 					$parsedQuery[$key] = $value;
863 863
 				} else {
864
-					$parsedQuery[$key] = (array)$parsedQuery[$key];
864
+					$parsedQuery[$key] = (array) $parsedQuery[$key];
865 865
 					$parsedQuery[$key][] = $value;
866 866
 				}
867 867
 			}
@@ -882,28 +882,28 @@  discard block
 block discarded – undo
882 882
 
883 883
 		if (is_string($request)) {
884 884
 			$isValid = preg_match("/(.+) (.+) (.+)\r\n/U", $request, $match);
885
-			if (!$this->quirksMode && (!$isValid || ($match[2] === '*' && !in_array($match[3], $asteriskMethods)))) {
885
+			if ( ! $this->quirksMode && ( ! $isValid || ($match[2] === '*' && ! in_array($match[3], $asteriskMethods)))) {
886 886
 				throw new SocketException(__d('cake_dev', 'HttpSocket::_buildRequestLine - Passed an invalid request line string. Activate quirks mode to do this.'));
887 887
 			}
888 888
 			return $request;
889
-		} elseif (!is_array($request)) {
889
+		} elseif ( ! is_array($request)) {
890 890
 			return false;
891
-		} elseif (!array_key_exists('uri', $request)) {
891
+		} elseif ( ! array_key_exists('uri', $request)) {
892 892
 			return false;
893 893
 		}
894 894
 
895 895
 		$request['uri'] = $this->_parseUri($request['uri']);
896 896
 		$request = array_merge(array('method' => 'GET'), $request);
897
-		if (!empty($this->_proxy['host'])) {
897
+		if ( ! empty($this->_proxy['host'])) {
898 898
 			$request['uri'] = $this->_buildUri($request['uri'], '%scheme://%host:%port/%path?%query');
899 899
 		} else {
900 900
 			$request['uri'] = $this->_buildUri($request['uri'], '/%path?%query');
901 901
 		}
902 902
 
903
-		if (!$this->quirksMode && $request['uri'] === '*' && !in_array($request['method'], $asteriskMethods)) {
903
+		if ( ! $this->quirksMode && $request['uri'] === '*' && ! in_array($request['method'], $asteriskMethods)) {
904 904
 			throw new SocketException(__d('cake_dev', 'HttpSocket::_buildRequestLine - The "*" asterisk character is only allowed for the following methods: %s. Activate quirks mode to work outside of HTTP/1.1 specs.', implode(',', $asteriskMethods)));
905 905
 		}
906
-		return $request['method'] . ' ' . $request['uri'] . ' ' . $versionToken . "\r\n";
906
+		return $request['method'].' '.$request['uri'].' '.$versionToken."\r\n";
907 907
 	}
908 908
 
909 909
 /**
@@ -916,7 +916,7 @@  discard block
 block discarded – undo
916 916
 	protected function _buildHeader($header, $mode = 'standard') {
917 917
 		if (is_string($header)) {
918 918
 			return $header;
919
-		} elseif (!is_array($header)) {
919
+		} elseif ( ! is_array($header)) {
920 920
 			return false;
921 921
 		}
922 922
 
@@ -936,11 +936,11 @@  discard block
 block discarded – undo
936 936
 			if (is_array($contents) && $mode === 'standard') {
937 937
 				$contents = implode(',', $contents);
938 938
 			}
939
-			foreach ((array)$contents as $content) {
939
+			foreach ((array) $contents as $content) {
940 940
 				$contents = preg_replace("/\r\n(?![\t ])/", "\r\n ", $content);
941 941
 				$field = $this->_escapeToken($field);
942 942
 
943
-				$returnHeader .= $field . ': ' . $contents . "\r\n";
943
+				$returnHeader .= $field.': '.$contents."\r\n";
944 944
 			}
945 945
 		}
946 946
 		return $returnHeader;
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
 			} else {
964 964
 				$value = $this->_escapeToken($cookie, array(';'));
965 965
 			}
966
-			$header[] = $name . '=' . $value;
966
+			$header[] = $name.'='.$value;
967 967
 		}
968 968
 		return $this->_buildHeader(array('Cookie' => implode('; ', $header)), 'pragmatic');
969 969
 	}
@@ -976,7 +976,7 @@  discard block
 block discarded – undo
976 976
  * @return string Escaped token
977 977
  */
978 978
 	protected function _escapeToken($token, $chars = null) {
979
-		$regex = '/([' . implode('', $this->_tokenEscapeChars(true, $chars)) . '])/';
979
+		$regex = '/(['.implode('', $this->_tokenEscapeChars(true, $chars)).'])/';
980 980
 		$token = preg_replace($regex, '"\\1"', $token);
981 981
 		return $token;
982 982
 	}
@@ -989,7 +989,7 @@  discard block
 block discarded – undo
989 989
  * @return array Escape chars
990 990
  */
991 991
 	protected function _tokenEscapeChars($hex = true, $chars = null) {
992
-		if (!empty($chars)) {
992
+		if ( ! empty($chars)) {
993 993
 			$escape = $chars;
994 994
 		} else {
995 995
 			$escape = array('"', "(", ")", "<", ">", "@", ",", ";", ":", "\\", "/", "[", "]", "?", "=", "{", "}", " ");
@@ -999,11 +999,11 @@  discard block
 block discarded – undo
999 999
 			$escape[] = chr(127);
1000 1000
 		}
1001 1001
 
1002
-		if (!$hex) {
1002
+		if ( ! $hex) {
1003 1003
 			return $escape;
1004 1004
 		}
1005 1005
 		foreach ($escape as $key => $char) {
1006
-			$escape[$key] = '\\x' . str_pad(dechex(ord($char)), 2, '0', STR_PAD_LEFT);
1006
+			$escape[$key] = '\\x'.str_pad(dechex(ord($char)), 2, '0', STR_PAD_LEFT);
1007 1007
 		}
1008 1008
 		return $escape;
1009 1009
 	}
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
 		if (empty($initalState)) {
1021 1021
 			$initalState = get_class_vars(__CLASS__);
1022 1022
 		}
1023
-		if (!$full) {
1023
+		if ( ! $full) {
1024 1024
 			$this->request = $initalState['request'];
1025 1025
 			$this->response = $initalState['response'];
1026 1026
 			return true;
Please login to merge, or discard this patch.
lib/Cake/Network/Http/HttpSocketResponse.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@
 block discarded – undo
104 104
  *
105 105
  * @param string $name Header name
106 106
  * @param array $headers
107
- * @return mixed String if header exists or null
107
+ * @return string|boolean String if header exists or null
108 108
  */
109 109
 	public function getHeader($name, $headers = null) {
110 110
 		if (!is_array($headers)) {
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
  * @return string
97 97
  */
98 98
 	public function body() {
99
-		return (string)$this->body;
99
+		return (string) $this->body;
100 100
 	}
101 101
 
102 102
 /**
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
  * @return mixed String if header exists or null
108 108
  */
109 109
 	public function getHeader($name, $headers = null) {
110
-		if (!is_array($headers)) {
111
-			$headers =& $this->headers;
110
+		if ( ! is_array($headers)) {
111
+			$headers = & $this->headers;
112 112
 		}
113 113
 		if (isset($headers[$name])) {
114 114
 			return $headers[$name];
@@ -147,17 +147,17 @@  discard block
 block discarded – undo
147 147
  * @throws SocketException
148 148
  */
149 149
 	public function parseResponse($message) {
150
-		if (!is_string($message)) {
150
+		if ( ! is_string($message)) {
151 151
 			throw new SocketException(__d('cake_dev', 'Invalid response.'));
152 152
 		}
153 153
 
154
-		if (!preg_match("/^(.+\r\n)(.*)(?<=\r\n)\r\n/Us", $message, $match)) {
154
+		if ( ! preg_match("/^(.+\r\n)(.*)(?<=\r\n)\r\n/Us", $message, $match)) {
155 155
 			throw new SocketException(__d('cake_dev', 'Invalid HTTP response.'));
156 156
 		}
157 157
 
158 158
 		list(, $statusLine, $header) = $match;
159 159
 		$this->raw = $message;
160
-		$this->body = (string)substr($message, strlen($match[0]));
160
+		$this->body = (string) substr($message, strlen($match[0]));
161 161
 
162 162
 		if (preg_match("/(.+) ([0-9]{3})\s*([^ ]*)\r\n/DU", $statusLine, $match)) {
163 163
 			$this->httpVersion = $match[1];
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
 		$decoded = $this->_decodeBody($this->body, $transferEncoding);
171 171
 		$this->body = $decoded['body'];
172 172
 
173
-		if (!empty($decoded['header'])) {
174
-			$this->headers = $this->_parseHeader($this->_buildHeader($this->headers) . $this->_buildHeader($decoded['header']));
173
+		if ( ! empty($decoded['header'])) {
174
+			$this->headers = $this->_parseHeader($this->_buildHeader($this->headers).$this->_buildHeader($decoded['header']));
175 175
 		}
176 176
 
177
-		if (!empty($this->headers)) {
177
+		if ( ! empty($this->headers)) {
178 178
 			$this->cookies = $this->parseCookies($this->headers);
179 179
 		}
180 180
 	}
@@ -188,15 +188,15 @@  discard block
 block discarded – undo
188 188
  * @return mixed Array of response headers and body or false.
189 189
  */
190 190
 	protected function _decodeBody($body, $encoding = 'chunked') {
191
-		if (!is_string($body)) {
191
+		if ( ! is_string($body)) {
192 192
 			return false;
193 193
 		}
194 194
 		if (empty($encoding)) {
195 195
 			return array('body' => $body, 'header' => false);
196 196
 		}
197
-		$decodeMethod = '_decode' . Inflector::camelize(str_replace('-', '_', $encoding)) . 'Body';
197
+		$decodeMethod = '_decode'.Inflector::camelize(str_replace('-', '_', $encoding)).'Body';
198 198
 
199
-		if (!is_callable(array(&$this, $decodeMethod))) {
199
+		if ( ! is_callable(array(&$this, $decodeMethod))) {
200 200
 			return array('body' => $body, 'header' => false);
201 201
 		}
202 202
 		return $this->{$decodeMethod}($body);
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
  * @throws SocketException
212 212
  */
213 213
 	protected function _decodeChunkedBody($body) {
214
-		if (!is_string($body)) {
214
+		if ( ! is_string($body)) {
215 215
 			return false;
216 216
 		}
217 217
 
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 		$chunkLength = null;
220 220
 
221 221
 		while ($chunkLength !== 0) {
222
-			if (!preg_match('/^([0-9a-f]+) *(?:;(.+)=(.+))?(?:\r\n|\n)/iU', $body, $match)) {
222
+			if ( ! preg_match('/^([0-9a-f]+) *(?:;(.+)=(.+))?(?:\r\n|\n)/iU', $body, $match)) {
223 223
 				throw new SocketException(__d('cake_dev', 'HttpSocket::_decodeChunkedBody - Could not parse malformed chunk.'));
224 224
 			}
225 225
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 		}
247 247
 
248 248
 		$entityHeader = false;
249
-		if (!empty($body)) {
249
+		if ( ! empty($body)) {
250 250
 			$entityHeader = $this->_parseHeader($body);
251 251
 		}
252 252
 		return array('body' => $decodedBody, 'header' => $entityHeader);
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 	protected function _parseHeader($header) {
262 262
 		if (is_array($header)) {
263 263
 			return $header;
264
-		} elseif (!is_string($header)) {
264
+		} elseif ( ! is_string($header)) {
265 265
 			return false;
266 266
 		}
267 267
 
@@ -276,10 +276,10 @@  discard block
 block discarded – undo
276 276
 
277 277
 			$field = $this->_unescapeToken($field);
278 278
 
279
-			if (!isset($header[$field])) {
279
+			if ( ! isset($header[$field])) {
280 280
 				$header[$field] = $value;
281 281
 			} else {
282
-				$header[$field] = array_merge((array)$header[$field], (array)$value);
282
+				$header[$field] = array_merge((array) $header[$field], (array) $value);
283 283
 			}
284 284
 		}
285 285
 		return $header;
@@ -293,12 +293,12 @@  discard block
 block discarded – undo
293 293
  */
294 294
 	public function parseCookies($header) {
295 295
 		$cookieHeader = $this->getHeader('Set-Cookie', $header);
296
-		if (!$cookieHeader) {
296
+		if ( ! $cookieHeader) {
297 297
 			return false;
298 298
 		}
299 299
 
300 300
 		$cookies = array();
301
-		foreach ((array)$cookieHeader as $cookie) {
301
+		foreach ((array) $cookieHeader as $cookie) {
302 302
 			if (strpos($cookie, '";"') !== false) {
303 303
 				$cookie = str_replace('";"', "{__cookie_replace__}", $cookie);
304 304
 				$parts = str_replace("{__cookie_replace__}", '";"', explode(';', $cookie));
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 				}
319 319
 
320 320
 				$key = strtolower($key);
321
-				if (!isset($cookies[$name][$key])) {
321
+				if ( ! isset($cookies[$name][$key])) {
322 322
 					$cookies[$name][$key] = $value;
323 323
 				}
324 324
 			}
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
  * @return string Unescaped token
335 335
  */
336 336
 	protected function _unescapeToken($token, $chars = null) {
337
-		$regex = '/"([' . implode('', $this->_tokenEscapeChars(true, $chars)) . '])"/';
337
+		$regex = '/"(['.implode('', $this->_tokenEscapeChars(true, $chars)).'])"/';
338 338
 		$token = preg_replace($regex, '\\1', $token);
339 339
 		return $token;
340 340
 	}
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
  * @return array Escape chars
348 348
  */
349 349
 	protected function _tokenEscapeChars($hex = true, $chars = null) {
350
-		if (!empty($chars)) {
350
+		if ( ! empty($chars)) {
351 351
 			$escape = $chars;
352 352
 		} else {
353 353
 			$escape = array('"', "(", ")", "<", ">", "@", ",", ";", ":", "\\", "/", "[", "]", "?", "=", "{", "}", " ");
@@ -357,11 +357,11 @@  discard block
 block discarded – undo
357 357
 			$escape[] = chr(127);
358 358
 		}
359 359
 
360
-		if (!$hex) {
360
+		if ( ! $hex) {
361 361
 			return $escape;
362 362
 		}
363 363
 		foreach ($escape as $key => $char) {
364
-			$escape[$key] = '\\x' . str_pad(dechex(ord($char)), 2, '0', STR_PAD_LEFT);
364
+			$escape[$key] = '\\x'.str_pad(dechex(ord($char)), 2, '0', STR_PAD_LEFT);
365 365
 		}
366 366
 		return $escape;
367 367
 	}
@@ -389,10 +389,10 @@  discard block
 block discarded – undo
389 389
 				if ($this->raw[$firstLineLength] === "\r") {
390 390
 					$header = null;
391 391
 				} else {
392
-					$header = substr($this->raw, $firstLineLength, strpos($this->raw, "\r\n\r\n") - $firstLineLength) . "\r\n";
392
+					$header = substr($this->raw, $firstLineLength, strpos($this->raw, "\r\n\r\n") - $firstLineLength)."\r\n";
393 393
 				}
394 394
 				return array(
395
-					'status-line' => $this->httpVersion . ' ' . $this->code . ' ' . $this->reasonPhrase . "\r\n",
395
+					'status-line' => $this->httpVersion.' '.$this->code.' '.$this->reasonPhrase."\r\n",
396 396
 					'header' => $header,
397 397
 					'body' => $this->body,
398 398
 					'response' => $this->raw
Please login to merge, or discard this patch.
lib/Cake/Routing/Dispatcher.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -239,7 +239,7 @@
 block discarded – undo
239 239
  * Load controller and return controller class name
240 240
  *
241 241
  * @param CakeRequest $request
242
- * @return string|boolean Name of controller class name
242
+ * @return string|false Name of controller class name
243 243
  */
244 244
 	protected function _loadController($request) {
245 245
 		$pluginName = $pluginPath = $controller = null;
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
  * @return CakeEventManager
65 65
  */
66 66
 	public function getEventManager() {
67
-		if (!$this->_eventManager) {
67
+		if ( ! $this->_eventManager) {
68 68
 			$this->_eventManager = new CakeEventManager();
69 69
 			$this->_eventManager->attach($this);
70 70
 			$this->_attachFilters($this->_eventManager);
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 			}
102 102
 			if (is_string($filter['callable'])) {
103 103
 				list($plugin, $callable) = pluginSplit($filter['callable'], true);
104
-				App::uses($callable, $plugin . 'Routing/Filter');
105
-				if (!class_exists($callable)) {
104
+				App::uses($callable, $plugin.'Routing/Filter');
105
+				if ( ! class_exists($callable)) {
106 106
 					throw new MissingDispatcherFilterException($callable);
107 107
 				}
108 108
 				$manager->attach(new $callable);
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 				if (isset($filter['priority'])) {
113 113
 					$options = array('priority' => $filter['priority']);
114 114
 				}
115
-				$manager->attach($filter['callable'], 'Dispatcher.' . $on . 'Dispatch', $options);
115
+				$manager->attach($filter['callable'], 'Dispatcher.'.$on.'Dispatch', $options);
116 116
 			}
117 117
 		}
118 118
 	}
@@ -150,9 +150,9 @@  discard block
 block discarded – undo
150 150
 
151 151
 		$controller = $this->_getController($request, $response);
152 152
 
153
-		if (!($controller instanceof Controller)) {
153
+		if ( ! ($controller instanceof Controller)) {
154 154
 			throw new MissingControllerException(array(
155
-				'class' => Inflector::camelize($request->params['controller']) . 'Controller',
155
+				'class' => Inflector::camelize($request->params['controller']).'Controller',
156 156
 				'plugin' => empty($request->params['plugin']) ? null : Inflector::camelize($request->params['plugin'])
157 157
 			));
158 158
 		}
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 
191 191
 		if ($render && $controller->autoRender) {
192 192
 			$response = $controller->render();
193
-		} elseif (!($result instanceof CakeResponse) && $response->body() === null) {
193
+		} elseif ( ! ($result instanceof CakeResponse) && $response->body() === null) {
194 194
 			$response->body($result);
195 195
 		}
196 196
 		$controller->shutdownProcess();
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 		$params = Router::parse($request->url);
212 212
 		$request->addParams($params);
213 213
 
214
-		if (!empty($event->data['additionalParams'])) {
214
+		if ( ! empty($event->data['additionalParams'])) {
215 215
 			$request->addParams($event->data['additionalParams']);
216 216
 		}
217 217
 	}
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
  */
226 226
 	protected function _getController($request, $response) {
227 227
 		$ctrlClass = $this->_loadController($request);
228
-		if (!$ctrlClass) {
228
+		if ( ! $ctrlClass) {
229 229
 			return false;
230 230
 		}
231 231
 		$reflection = new ReflectionClass($ctrlClass);
@@ -243,18 +243,18 @@  discard block
 block discarded – undo
243 243
  */
244 244
 	protected function _loadController($request) {
245 245
 		$pluginName = $pluginPath = $controller = null;
246
-		if (!empty($request->params['plugin'])) {
246
+		if ( ! empty($request->params['plugin'])) {
247 247
 			$pluginName = $controller = Inflector::camelize($request->params['plugin']);
248
-			$pluginPath = $pluginName . '.';
248
+			$pluginPath = $pluginName.'.';
249 249
 		}
250
-		if (!empty($request->params['controller'])) {
250
+		if ( ! empty($request->params['controller'])) {
251 251
 			$controller = Inflector::camelize($request->params['controller']);
252 252
 		}
253
-		if ($pluginPath . $controller) {
254
-			$class = $controller . 'Controller';
253
+		if ($pluginPath.$controller) {
254
+			$class = $controller.'Controller';
255 255
 			App::uses('AppController', 'Controller');
256
-			App::uses($pluginName . 'AppController', $pluginPath . 'Controller');
257
-			App::uses($class, $pluginPath . 'Controller');
256
+			App::uses($pluginName.'AppController', $pluginPath.'Controller');
257
+			App::uses($class, $pluginPath.'Controller');
258 258
 			if (class_exists($class)) {
259 259
 				return $class;
260 260
 			}
Please login to merge, or discard this patch.
lib/Cake/Routing/Route/CakeRoute.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
  * Modifies defaults property so all necessary keys are set
110 110
  * and populates $this->names with the named routing elements.
111 111
  *
112
- * @return array Returns a string regular expression of the compiled route.
112
+ * @return string Returns a string regular expression of the compiled route.
113 113
  */
114 114
 	public function compile() {
115 115
 		if ($this->compiled()) {
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
  * Currently implemented rule types are controller, action and match that can be combined with each other.
333 333
  *
334 334
  * @param string $val The value of the named parameter
335
- * @param array $rule The rule(s) to apply, can also be a match string
335
+ * @param string $rule The rule(s) to apply, can also be a match string
336 336
  * @param string $context An array with additional context information (controller / action)
337 337
  * @return boolean
338 338
  */
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
  * This method handles the reverse routing or conversion of URL arrays into string URLs.
394 394
  *
395 395
  * @param array $url An array of parameters to check matching with.
396
- * @return mixed Either a string URL for the parameters if they match or false.
396
+ * @return false|string Either a string URL for the parameters if they match or false.
397 397
  */
398 398
 	public function match($url) {
399 399
 		if (!$this->compiled()) {
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
  */
91 91
 	public function __construct($template, $defaults = array(), $options = array()) {
92 92
 		$this->template = $template;
93
-		$this->defaults = (array)$defaults;
94
-		$this->options = (array)$options;
93
+		$this->defaults = (array) $defaults;
94
+		$this->options = (array) $options;
95 95
 	}
96 96
 
97 97
 /**
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
  * @return boolean
101 101
  */
102 102
 	public function compiled() {
103
-		return !empty($this->_compiledRoute);
103
+		return ! empty($this->_compiledRoute);
104 104
 	}
105 105
 
106 106
 /**
@@ -139,20 +139,20 @@  discard block
 block discarded – undo
139 139
 
140 140
 		preg_match_all('#:([A-Za-z0-9_-]+[A-Z0-9a-z])#', $route, $namedElements);
141 141
 		foreach ($namedElements[1] as $i => $name) {
142
-			$search = '\\' . $namedElements[0][$i];
142
+			$search = '\\'.$namedElements[0][$i];
143 143
 			if (isset($this->options[$name])) {
144 144
 				$option = null;
145 145
 				if ($name !== 'plugin' && array_key_exists($name, $this->defaults)) {
146 146
 					$option = '?';
147 147
 				}
148
-				$slashParam = '/\\' . $namedElements[0][$i];
148
+				$slashParam = '/\\'.$namedElements[0][$i];
149 149
 				if (strpos($parsed, $slashParam) !== false) {
150
-					$routeParams[$slashParam] = '(?:/(?P<' . $name . '>' . $this->options[$name] . ')' . $option . ')' . $option;
150
+					$routeParams[$slashParam] = '(?:/(?P<'.$name.'>'.$this->options[$name].')'.$option.')'.$option;
151 151
 				} else {
152
-					$routeParams[$search] = '(?:(?P<' . $name . '>' . $this->options[$name] . ')' . $option . ')' . $option;
152
+					$routeParams[$search] = '(?:(?P<'.$name.'>'.$this->options[$name].')'.$option.')'.$option;
153 153
 				}
154 154
 			} else {
155
-				$routeParams[$search] = '(?:(?P<' . $name . '>[^/]+))';
155
+				$routeParams[$search] = '(?:(?P<'.$name.'>[^/]+))';
156 156
 			}
157 157
 			$names[] = $name;
158 158
 		}
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 		}
167 167
 		krsort($routeParams);
168 168
 		$parsed = str_replace(array_keys($routeParams), array_values($routeParams), $parsed);
169
-		$this->_compiledRoute = '#^' . $parsed . '[/]*$#';
169
+		$this->_compiledRoute = '#^'.$parsed.'[/]*$#';
170 170
 		$this->keys = $names;
171 171
 
172 172
 		// Remove defaults that are also keys. They can cause match failures
@@ -189,23 +189,23 @@  discard block
 block discarded – undo
189 189
  * @return mixed Boolean false on failure, otherwise an array or parameters
190 190
  */
191 191
 	public function parse($url) {
192
-		if (!$this->compiled()) {
192
+		if ( ! $this->compiled()) {
193 193
 			$this->compile();
194 194
 		}
195
-		if (!preg_match($this->_compiledRoute, urldecode($url), $route)) {
195
+		if ( ! preg_match($this->_compiledRoute, urldecode($url), $route)) {
196 196
 			return false;
197 197
 		}
198 198
 		foreach ($this->defaults as $key => $val) {
199
-			$key = (string)$key;
199
+			$key = (string) $key;
200 200
 			if ($key[0] === '[' && preg_match('/^\[(\w+)\]$/', $key, $header)) {
201 201
 				if (isset($this->_headerMap[$header[1]])) {
202 202
 					$header = $this->_headerMap[$header[1]];
203 203
 				} else {
204
-					$header = 'http_' . $header[1];
204
+					$header = 'http_'.$header[1];
205 205
 				}
206 206
 				$header = strtoupper($header);
207 207
 
208
-				$val = (array)$val;
208
+				$val = (array) $val;
209 209
 				$h = false;
210 210
 
211 211
 				foreach ($val as $v) {
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 						$h = true;
214 214
 					}
215 215
 				}
216
-				if (!$h) {
216
+				if ( ! $h) {
217 217
 					return false;
218 218
 				}
219 219
 			}
@@ -276,9 +276,9 @@  discard block
 block discarded – undo
276 276
 		$namedConfig = Router::namedConfig();
277 277
 		$greedy = $namedConfig['greedyNamed'];
278 278
 		$rules = $namedConfig['rules'];
279
-		if (!empty($this->options['named'])) {
279
+		if ( ! empty($this->options['named'])) {
280 280
 			$greedy = isset($this->options['greedyNamed']) && $this->options['greedyNamed'] === true;
281
-			foreach ((array)$this->options['named'] as $key => $val) {
281
+			foreach ((array) $this->options['named'] as $key => $val) {
282 282
 				if (is_numeric($key)) {
283 283
 					$rules[$val] = true;
284 284
 					continue;
@@ -293,10 +293,10 @@  discard block
 block discarded – undo
293 293
 			}
294 294
 
295 295
 			$separatorIsPresent = strpos($param, $namedConfig['separator']) !== false;
296
-			if ((!isset($this->options['named']) || !empty($this->options['named'])) && $separatorIsPresent) {
296
+			if (( ! isset($this->options['named']) || ! empty($this->options['named'])) && $separatorIsPresent) {
297 297
 				list($key, $val) = explode($namedConfig['separator'], $param, 2);
298 298
 				$hasRule = isset($rules[$key]);
299
-				$passIt = (!$hasRule && !$greedy) || ($hasRule && !$this->_matchNamed($val, $rules[$key], $context));
299
+				$passIt = ( ! $hasRule && ! $greedy) || ($hasRule && ! $this->_matchNamed($val, $rules[$key], $context));
300 300
 				if ($passIt) {
301 301
 					$pass[] = $param;
302 302
 				} else {
@@ -343,25 +343,25 @@  discard block
 block discarded – undo
343 343
 		if (is_string($rule)) {
344 344
 			$rule = array('match' => $rule);
345 345
 		}
346
-		if (!is_array($rule)) {
346
+		if ( ! is_array($rule)) {
347 347
 			return false;
348 348
 		}
349 349
 
350 350
 		$controllerMatches = (
351
-			!isset($rule['controller'], $context['controller']) ||
352
-			in_array($context['controller'], (array)$rule['controller'])
351
+			! isset($rule['controller'], $context['controller']) ||
352
+			in_array($context['controller'], (array) $rule['controller'])
353 353
 		);
354
-		if (!$controllerMatches) {
354
+		if ( ! $controllerMatches) {
355 355
 			return false;
356 356
 		}
357 357
 		$actionMatches = (
358
-			!isset($rule['action'], $context['action']) ||
359
-			in_array($context['action'], (array)$rule['action'])
358
+			! isset($rule['action'], $context['action']) ||
359
+			in_array($context['action'], (array) $rule['action'])
360 360
 		);
361
-		if (!$actionMatches) {
361
+		if ( ! $actionMatches) {
362 362
 			return false;
363 363
 		}
364
-		return (!isset($rule['match']) || preg_match('/' . $rule['match'] . '/', $val));
364
+		return ( ! isset($rule['match']) || preg_match('/'.$rule['match'].'/', $val));
365 365
 	}
366 366
 
367 367
 /**
@@ -374,11 +374,11 @@  discard block
 block discarded – undo
374 374
  * @return array An array with persistent parameters applied.
375 375
  */
376 376
 	public function persistParams($url, $params) {
377
-		if (empty($this->options['persist']) || !is_array($this->options['persist'])) {
377
+		if (empty($this->options['persist']) || ! is_array($this->options['persist'])) {
378 378
 			return $url;
379 379
 		}
380 380
 		foreach ($this->options['persist'] as $persistKey) {
381
-			if (array_key_exists($persistKey, $params) && !isset($url[$persistKey])) {
381
+			if (array_key_exists($persistKey, $params) && ! isset($url[$persistKey])) {
382 382
 				$url[$persistKey] = $params[$persistKey];
383 383
 			}
384 384
 		}
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
  * @return mixed Either a string URL for the parameters if they match or false.
397 397
  */
398 398
 	public function match($url) {
399
-		if (!$this->compiled()) {
399
+		if ( ! $this->compiled()) {
400 400
 			$this->compile();
401 401
 		}
402 402
 		$defaults = $this->defaults;
@@ -451,27 +451,27 @@  discard block
 block discarded – undo
451 451
 			if (
452 452
 				($greedyNamed || isset($allowedNamedParams[$key])) &&
453 453
 				($value !== false && $value !== null) &&
454
-				(!in_array($key, $prefixes))
454
+				( ! in_array($key, $prefixes))
455 455
 			) {
456 456
 				$named[$key] = $value;
457 457
 				continue;
458 458
 			}
459 459
 
460 460
 			// keys that don't exist are different.
461
-			if (!$defaultExists && !empty($value)) {
461
+			if ( ! $defaultExists && ! empty($value)) {
462 462
 				return false;
463 463
 			}
464 464
 		}
465 465
 
466 466
 		//if a not a greedy route, no extra params are allowed.
467
-		if (!$this->_greedy && (!empty($pass) || !empty($named))) {
467
+		if ( ! $this->_greedy && ( ! empty($pass) || ! empty($named))) {
468 468
 			return false;
469 469
 		}
470 470
 
471 471
 		//check patterns for routed params
472
-		if (!empty($this->options)) {
472
+		if ( ! empty($this->options)) {
473 473
 			foreach ($this->options as $key => $pattern) {
474
-				if (array_key_exists($key, $url) && !preg_match('#^' . $pattern . '$#', $url[$key])) {
474
+				if (array_key_exists($key, $url) && ! preg_match('#^'.$pattern.'$#', $url[$key])) {
475 475
 					return false;
476 476
 				}
477 477
 			}
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
  */
491 491
 	protected function _writeUrl($params) {
492 492
 		if (isset($params['prefix'])) {
493
-			$prefixed = $params['prefix'] . '_';
493
+			$prefixed = $params['prefix'].'_';
494 494
 		}
495 495
 		if (isset($prefixed, $params['action']) && strpos($params['action'], $prefixed) === 0) {
496 496
 			$params['action'] = substr($params['action'], strlen($prefixed));
@@ -504,23 +504,23 @@  discard block
 block discarded – undo
504 504
 		$namedConfig = Router::namedConfig();
505 505
 		$separator = $namedConfig['separator'];
506 506
 
507
-		if (!empty($params['named']) && is_array($params['named'])) {
507
+		if ( ! empty($params['named']) && is_array($params['named'])) {
508 508
 			$named = array();
509 509
 			foreach ($params['named'] as $key => $value) {
510 510
 				if (is_array($value)) {
511 511
 					$flat = Hash::flatten($value, '%5D%5B');
512 512
 					foreach ($flat as $namedKey => $namedValue) {
513
-						$named[] = $key . "%5B{$namedKey}%5D" . $separator . rawurlencode($namedValue);
513
+						$named[] = $key."%5B{$namedKey}%5D".$separator.rawurlencode($namedValue);
514 514
 					}
515 515
 				} else {
516
-					$named[] = $key . $separator . rawurlencode($value);
516
+					$named[] = $key.$separator.rawurlencode($value);
517 517
 				}
518 518
 			}
519
-			$params['pass'] = $params['pass'] . '/' . implode('/', $named);
519
+			$params['pass'] = $params['pass'].'/'.implode('/', $named);
520 520
 		}
521 521
 		$out = $this->template;
522 522
 
523
-		if (!empty($this->keys)) {
523
+		if ( ! empty($this->keys)) {
524 524
 			$search = $replace = array();
525 525
 
526 526
 			foreach ($this->keys as $key) {
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 				} elseif (strpos($out, $key) != strlen($out) - strlen($key)) {
531 531
 					$key .= '/';
532 532
 				}
533
-				$search[] = ':' . $key;
533
+				$search[] = ':'.$key;
534 534
 				$replace[] = $string;
535 535
 			}
536 536
 			$out = str_replace($search, $replace, $out);
Please login to merge, or discard this patch.
lib/Cake/Routing/Route/PluginShortRoute.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
  * controller parameter
29 29
  *
30 30
  * @param string $url The URL to parse
31
- * @return mixed false on failure, or an array of request parameters
31
+ * @return boolean false on failure, or an array of request parameters
32 32
  */
33 33
 	public function parse($url) {
34 34
 		$params = parent::parse($url);
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
  * are not the same the match is an auto fail.
45 45
  *
46 46
  * @param array $url Array of parameters to convert to a string.
47
- * @return mixed either false or a string URL.
47
+ * @return false|string either false or a string URL.
48 48
  */
49 49
 	public function match($url) {
50 50
 		if (isset($url['controller']) && isset($url['plugin']) && $url['plugin'] != $url['controller']) {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
  */
33 33
 	public function parse($url) {
34 34
 		$params = parent::parse($url);
35
-		if (!$params) {
35
+		if ( ! $params) {
36 36
 			return false;
37 37
 		}
38 38
 		$params['controller'] = $params['plugin'];
Please login to merge, or discard this patch.
lib/Cake/Routing/Route/RedirectRoute.php 2 patches
Doc Comments   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
  * redirection
65 65
  *
66 66
  * @param string $url The URL to parse
67
- * @return boolean False on failure
67
+ * @return false|null False on failure
68 68
  */
69 69
 	public function parse($url) {
70 70
 		$params = parent::parse($url);
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
  * There is no reverse routing redirection routes
104 104
  *
105 105
  * @param array $url Array of parameters to convert to a string.
106
- * @return mixed either false or a string URL.
106
+ * @return boolean either false or a string URL.
107 107
  */
108 108
 	public function match($url) {
109 109
 		return false;
@@ -113,7 +113,6 @@  discard block
 block discarded – undo
113 113
  * Stop execution of the current script. Wraps exit() making
114 114
  * testing easier.
115 115
  *
116
- * @param integer|string $status see http://php.net/exit for values
117 116
  * @return void
118 117
  */
119 118
 	protected function _stop($code = 0) {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
  */
57 57
 	public function __construct($template, $defaults = array(), $options = array()) {
58 58
 		parent::__construct($template, $defaults, $options);
59
-		$this->redirect = (array)$defaults;
59
+		$this->redirect = (array) $defaults;
60 60
 	}
61 61
 
62 62
 /**
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
  */
69 69
 	public function parse($url) {
70 70
 		$params = parent::parse($url);
71
-		if (!$params) {
71
+		if ( ! $params) {
72 72
 			return false;
73 73
 		}
74
-		if (!$this->response) {
74
+		if ( ! $this->response) {
75 75
 			$this->response = new CakeResponse();
76 76
 		}
77 77
 		$redirect = $this->redirect;
78
-		if (count($this->redirect) === 1 && !isset($this->redirect['controller'])) {
78
+		if (count($this->redirect) === 1 && ! isset($this->redirect['controller'])) {
79 79
 			$redirect = $this->redirect[0];
80 80
 		}
81 81
 		if (isset($this->options['persist']) && is_array($redirect)) {
Please login to merge, or discard this patch.
lib/Cake/Routing/Router.php 2 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
  * Set the default route class to use or return the current one
209 209
  *
210 210
  * @param string $routeClass to set as default
211
- * @return mixed void|string
211
+ * @return string|null void|string
212 212
  * @throws RouterException
213 213
  */
214 214
 	public static function defaultRouteClass($routeClass = null) {
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
  * @param array $named A list of named parameters. Key value pairs are accepted where values are
472 472
  *    either regex strings to match, or arrays as seen above.
473 473
  * @param array $options Allows to control all settings: separator, greedy, reset, default
474
- * @return array
474
+ * @return string
475 475
  */
476 476
 	public static function connectNamed($named, $options = array()) {
477 477
 		if (isset($options['separator'])) {
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 /**
509 509
  * Gets the current named parameter configuration values.
510 510
  *
511
- * @return array
511
+ * @return string
512 512
  * @see Router::$_namedConfig
513 513
  */
514 514
 	public static function namedConfig() {
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
  *    integer values and UUIDs.
527 527
  * - 'prefix' - URL prefix to use for the generated routes. Defaults to '/'.
528 528
  *
529
- * @param string|array $controller A controller name or array of controller names (i.e. "Posts" or "ListItems")
529
+ * @param string $controller A controller name or array of controller names (i.e. "Posts" or "ListItems")
530 530
  * @param array $options Options to use when generating REST routes
531 531
  * @return array Array of mapped resources
532 532
  */
@@ -1054,7 +1054,7 @@  discard block
 block discarded – undo
1054 1054
  *    an array of arguments to convert into a query string.
1055 1055
  * @param array $extra Extra querystring parameters.
1056 1056
  * @param boolean $escape Whether or not to use escaped &
1057
- * @return array
1057
+ * @return null|string
1058 1058
  */
1059 1059
 	public static function queryString($q, $extra = array(), $escape = false) {
1060 1060
 		if (empty($q) && empty($extra)) {
Please login to merge, or discard this patch.
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	protected static function _validateRouteClass($routeClass) {
230 230
 		if (
231 231
 			$routeClass !== 'CakeRoute' &&
232
-			(!class_exists($routeClass) || !is_subclass_of($routeClass, 'CakeRoute'))
232
+			( ! class_exists($routeClass) || ! is_subclass_of($routeClass, 'CakeRoute'))
233 233
 		) {
234 234
 			throw new RouterException(__d('cake_dev', 'Route class not found, or route class is not a subclass of CakeRoute'));
235 235
 		}
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
  */
244 244
 	protected static function _setPrefixes() {
245 245
 		$routing = Configure::read('Routing');
246
-		if (!empty($routing['prefixes'])) {
247
-			self::$_prefixes = array_merge(self::$_prefixes, (array)$routing['prefixes']);
246
+		if ( ! empty($routing['prefixes'])) {
247
+			self::$_prefixes = array_merge(self::$_prefixes, (array) $routing['prefixes']);
248 248
 		}
249 249
 	}
250 250
 
@@ -534,27 +534,27 @@  discard block
 block discarded – undo
534 534
 		$hasPrefix = isset($options['prefix']);
535 535
 		$options = array_merge(array(
536 536
 			'prefix' => '/',
537
-			'id' => self::ID . '|' . self::UUID
537
+			'id' => self::ID.'|'.self::UUID
538 538
 		), $options);
539 539
 
540 540
 		$prefix = $options['prefix'];
541 541
 		if (strpos($prefix, '/') !== 0) {
542
-			$prefix = '/' . $prefix;
542
+			$prefix = '/'.$prefix;
543 543
 		}
544 544
 		if (substr($prefix, -1) !== '/') {
545 545
 			$prefix .= '/';
546 546
 		}
547 547
 
548
-		foreach ((array)$controller as $name) {
548
+		foreach ((array) $controller as $name) {
549 549
 			list($plugin, $name) = pluginSplit($name);
550 550
 			$urlName = Inflector::underscore($name);
551 551
 			$plugin = Inflector::underscore($plugin);
552
-			if ($plugin && !$hasPrefix) {
553
-				$prefix = '/' . $plugin . '/';
552
+			if ($plugin && ! $hasPrefix) {
553
+				$prefix = '/'.$plugin.'/';
554 554
 			}
555 555
 
556 556
 			foreach (self::$_resourceMap as $params) {
557
-				$url = $prefix . $urlName . (($params['id']) ? '/:id' : '');
557
+				$url = $prefix.$urlName.(($params['id']) ? '/:id' : '');
558 558
 
559 559
 				Router::connect($url,
560 560
 					array(
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
  * @return array Parsed elements from URL
588 588
  */
589 589
 	public static function parse($url) {
590
-		if (!self::$initialized) {
590
+		if ( ! self::$initialized) {
591 591
 			self::_loadRoutes();
592 592
 		}
593 593
 
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 		$out = array();
596 596
 
597 597
 		if (strlen($url) && strpos($url, '/') !== 0) {
598
-			$url = '/' . $url;
598
+			$url = '/'.$url;
599 599
 		}
600 600
 		if (strpos($url, '?') !== false) {
601 601
 			list($url, $queryParameters) = explode('?', $url, 2);
@@ -605,23 +605,23 @@  discard block
 block discarded – undo
605 605
 		extract(self::_parseExtension($url));
606 606
 
607 607
 		for ($i = 0, $len = count(self::$routes); $i < $len; $i++) {
608
-			$route =& self::$routes[$i];
608
+			$route = & self::$routes[$i];
609 609
 
610 610
 			if (($r = $route->parse($url)) !== false) {
611
-				self::$_currentRoute[] =& $route;
611
+				self::$_currentRoute[] = & $route;
612 612
 				$out = $r;
613 613
 				break;
614 614
 			}
615 615
 		}
616 616
 		if (isset($out['prefix'])) {
617
-			$out['action'] = $out['prefix'] . '_' . $out['action'];
617
+			$out['action'] = $out['prefix'].'_'.$out['action'];
618 618
 		}
619 619
 
620
-		if (!empty($ext) && !isset($out['ext'])) {
620
+		if ( ! empty($ext) && ! isset($out['ext'])) {
621 621
 			$out['ext'] = $ext;
622 622
 		}
623 623
 
624
-		if (!empty($queryParameters) && !isset($out['?'])) {
624
+		if ( ! empty($queryParameters) && ! isset($out['?'])) {
625 625
 			$out['?'] = $queryParameters;
626 626
 		}
627 627
 		return $out;
@@ -640,12 +640,12 @@  discard block
 block discarded – undo
640 640
 			if (preg_match('/\.[0-9a-zA-Z]*$/', $url, $match) === 1) {
641 641
 				$match = substr($match[0], 1);
642 642
 				if (empty(self::$_validExtensions)) {
643
-					$url = substr($url, 0, strpos($url, '.' . $match));
643
+					$url = substr($url, 0, strpos($url, '.'.$match));
644 644
 					$ext = $match;
645 645
 				} else {
646 646
 					foreach (self::$_validExtensions as $name) {
647 647
 						if (strcasecmp($name, $match) === 0) {
648
-							$url = substr($url, 0, strpos($url, '.' . $name));
648
+							$url = substr($url, 0, strpos($url, '.'.$name));
649 649
 							$ext = $match;
650 650
 							break;
651 651
 						}
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
 		if ($current) {
749 749
 			return self::$_requests[count(self::$_requests) - 1];
750 750
 		}
751
-		if (!isset(self::$_requests[0])) {
751
+		if ( ! isset(self::$_requests[0])) {
752 752
 			return array('base' => null);
753 753
 		}
754 754
 		return array('base' => self::$_requests[0]->base);
@@ -785,10 +785,10 @@  discard block
 block discarded – undo
785 785
 		if ($which === null) {
786 786
 			$which = count(self::$routes) - 1;
787 787
 		}
788
-		if (!isset(self::$routes[$which])) {
788
+		if ( ! isset(self::$routes[$which])) {
789 789
 			return false;
790 790
 		}
791
-		$route =& self::$routes[$which];
791
+		$route = & self::$routes[$which];
792 792
 		unset(self::$routes[$which]);
793 793
 		array_unshift(self::$routes, $route);
794 794
 		return true;
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
  * @return string Full translated URL with base path.
825 825
  */
826 826
 	public static function url($url = null, $full = false) {
827
-		if (!self::$initialized) {
827
+		if ( ! self::$initialized) {
828 828
 			self::_loadRoutes();
829 829
 		}
830 830
 
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
 		}
838 838
 
839 839
 		$path = array('base' => null);
840
-		if (!empty(self::$_requests)) {
840
+		if ( ! empty(self::$_requests)) {
841 841
 			$request = self::$_requests[count(self::$_requests) - 1];
842 842
 			$params = $request->params;
843 843
 			$path = array('base' => $request->base, 'here' => $request->here);
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
 		if (empty($url)) {
853 853
 			$output = isset($path['here']) ? $path['here'] : '/';
854 854
 			if ($full) {
855
-				$output = self::fullBaseUrl() . $output;
855
+				$output = self::fullBaseUrl().$output;
856 856
 			}
857 857
 			return $output;
858 858
 		} elseif (is_array($url)) {
@@ -869,11 +869,11 @@  discard block
 block discarded – undo
869 869
 				unset($url['?']);
870 870
 			}
871 871
 			if (isset($url['#'])) {
872
-				$frag = '#' . $url['#'];
872
+				$frag = '#'.$url['#'];
873 873
 				unset($url['#']);
874 874
 			}
875 875
 			if (isset($url['ext'])) {
876
-				$extension = '.' . $url['ext'];
876
+				$extension = '.'.$url['ext'];
877 877
 				unset($url['ext']);
878 878
 			}
879 879
 			if (empty($url['action'])) {
@@ -886,12 +886,12 @@  discard block
 block discarded – undo
886 886
 
887 887
 			$prefixExists = (array_intersect_key($url, array_flip(self::$_prefixes)));
888 888
 			foreach (self::$_prefixes as $prefix) {
889
-				if (!empty($params[$prefix]) && !$prefixExists) {
889
+				if ( ! empty($params[$prefix]) && ! $prefixExists) {
890 890
 					$url[$prefix] = true;
891
-				} elseif (isset($url[$prefix]) && !$url[$prefix]) {
891
+				} elseif (isset($url[$prefix]) && ! $url[$prefix]) {
892 892
 					unset($url[$prefix]);
893 893
 				}
894
-				if (isset($url[$prefix]) && strpos($url['action'], $prefix . '_') === 0) {
894
+				if (isset($url[$prefix]) && strpos($url['action'], $prefix.'_') === 0) {
895 895
 					$url['action'] = substr($url['action'], strlen($prefix) + 1);
896 896
 				}
897 897
 			}
@@ -923,28 +923,28 @@  discard block
 block discarded – undo
923 923
 			} else {
924 924
 				foreach (self::$_prefixes as $prefix) {
925 925
 					if (isset($params[$prefix])) {
926
-						$output .= $prefix . '/';
926
+						$output .= $prefix.'/';
927 927
 						break;
928 928
 					}
929 929
 				}
930
-				if (!empty($params['plugin']) && $params['plugin'] !== $params['controller']) {
931
-					$output .= Inflector::underscore($params['plugin']) . '/';
930
+				if ( ! empty($params['plugin']) && $params['plugin'] !== $params['controller']) {
931
+					$output .= Inflector::underscore($params['plugin']).'/';
932 932
 				}
933
-				$output .= Inflector::underscore($params['controller']) . '/' . $url;
933
+				$output .= Inflector::underscore($params['controller']).'/'.$url;
934 934
 			}
935 935
 		}
936 936
 		$protocol = preg_match('#^[a-z][a-z0-9+\-.]*\://#i', $output);
937 937
 		if ($protocol === 0) {
938
-			$output = str_replace('//', '/', $base . '/' . $output);
938
+			$output = str_replace('//', '/', $base.'/'.$output);
939 939
 
940 940
 			if ($full) {
941
-				$output = self::fullBaseUrl() . $output;
941
+				$output = self::fullBaseUrl().$output;
942 942
 			}
943
-			if (!empty($extension)) {
943
+			if ( ! empty($extension)) {
944 944
 				$output = rtrim($output, '/');
945 945
 			}
946 946
 		}
947
-		return $output . $extension . self::queryString($q, array(), $escape) . $frag;
947
+		return $output.$extension.self::queryString($q, array(), $escape).$frag;
948 948
 	}
949 949
 
950 950
 /**
@@ -1003,14 +1003,14 @@  discard block
 block discarded – undo
1003 1003
 
1004 1004
 		list($args, $named) = array(Hash::filter($args), Hash::filter($named));
1005 1005
 		foreach (self::$_prefixes as $prefix) {
1006
-			$prefixed = $prefix . '_';
1007
-			if (!empty($url[$prefix]) && strpos($url['action'], $prefixed) === 0) {
1006
+			$prefixed = $prefix.'_';
1007
+			if ( ! empty($url[$prefix]) && strpos($url['action'], $prefixed) === 0) {
1008 1008
 				$url['action'] = substr($url['action'], strlen($prefixed) * -1);
1009 1009
 				break;
1010 1010
 			}
1011 1011
 		}
1012 1012
 
1013
-		if (empty($named) && empty($args) && (!isset($url['action']) || $url['action'] === 'index')) {
1013
+		if (empty($named) && empty($args) && ( ! isset($url['action']) || $url['action'] === 'index')) {
1014 1014
 			$url['action'] = null;
1015 1015
 		}
1016 1016
 
@@ -1028,19 +1028,19 @@  discard block
 block discarded – undo
1028 1028
 		}
1029 1029
 		$output = implode('/', $urlOut);
1030 1030
 
1031
-		if (!empty($args)) {
1032
-			$output .= '/' . implode('/', array_map('rawurlencode', $args));
1031
+		if ( ! empty($args)) {
1032
+			$output .= '/'.implode('/', array_map('rawurlencode', $args));
1033 1033
 		}
1034 1034
 
1035
-		if (!empty($named)) {
1035
+		if ( ! empty($named)) {
1036 1036
 			foreach ($named as $name => $value) {
1037 1037
 				if (is_array($value)) {
1038 1038
 					$flattend = Hash::flatten($value, '%5D%5B');
1039 1039
 					foreach ($flattend as $namedKey => $namedValue) {
1040
-						$output .= '/' . $name . "%5B{$namedKey}%5D" . self::$_namedConfig['separator'] . rawurlencode($namedValue);
1040
+						$output .= '/'.$name."%5B{$namedKey}%5D".self::$_namedConfig['separator'].rawurlencode($namedValue);
1041 1041
 					}
1042 1042
 				} else {
1043
-					$output .= '/' . $name . self::$_namedConfig['separator'] . rawurlencode($value);
1043
+					$output .= '/'.$name.self::$_namedConfig['separator'].rawurlencode($value);
1044 1044
 				}
1045 1045
 			}
1046 1046
 		}
@@ -1081,7 +1081,7 @@  discard block
 block discarded – undo
1081 1081
 		$out .= $addition;
1082 1082
 
1083 1083
 		if (isset($out[0]) && $out[0] !== '?') {
1084
-			$out = '?' . $out;
1084
+			$out = '?'.$out;
1085 1085
 		}
1086 1086
 		return $out;
1087 1087
 	}
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
 			$params['_Token']
1118 1118
 		);
1119 1119
 		$params = array_merge($params, $pass, $named);
1120
-		if (!empty($url)) {
1120
+		if ( ! empty($url)) {
1121 1121
 			$params['?'] = $url;
1122 1122
 		}
1123 1123
 		return Router::url($params, $full);
@@ -1141,10 +1141,10 @@  discard block
 block discarded – undo
1141 1141
 		}
1142 1142
 		$request = Router::getRequest();
1143 1143
 
1144
-		if (!empty($request->base) && stristr($url, $request->base)) {
1145
-			$url = preg_replace('/^' . preg_quote($request->base, '/') . '/', '', $url, 1);
1144
+		if ( ! empty($request->base) && stristr($url, $request->base)) {
1145
+			$url = preg_replace('/^'.preg_quote($request->base, '/').'/', '', $url, 1);
1146 1146
 		}
1147
-		$url = '/' . $url;
1147
+		$url = '/'.$url;
1148 1148
 
1149 1149
 		while (strpos($url, '//') !== false) {
1150 1150
 			$url = str_replace('//', '/', $url);
@@ -1185,7 +1185,7 @@  discard block
 block discarded – undo
1185 1185
  */
1186 1186
 	public static function stripPlugin($base, $plugin = null) {
1187 1187
 		if ($plugin) {
1188
-			$base = preg_replace('/(?:' . $plugin . ')/', '', $base);
1188
+			$base = preg_replace('/(?:'.$plugin.')/', '', $base);
1189 1189
 			$base = str_replace('//', '', $base);
1190 1190
 			$pos1 = strrpos($base, '/');
1191 1191
 			$char = strlen($base) - 1;
@@ -1230,7 +1230,7 @@  discard block
 block discarded – undo
1230 1230
  * @return array Array of extensions Router is configured to parse.
1231 1231
  */
1232 1232
 	public static function extensions() {
1233
-		if (!self::$initialized) {
1233
+		if ( ! self::$initialized) {
1234 1234
 			self::_loadRoutes();
1235 1235
 		}
1236 1236
 
@@ -1247,10 +1247,10 @@  discard block
 block discarded – undo
1247 1247
  * @return array
1248 1248
  */
1249 1249
 	public static function setExtensions($extensions, $merge = true) {
1250
-		if (!is_array($extensions)) {
1250
+		if ( ! is_array($extensions)) {
1251 1251
 			return self::$_validExtensions;
1252 1252
 		}
1253
-		if (!$merge) {
1253
+		if ( ! $merge) {
1254 1254
 			return self::$_validExtensions = $extensions;
1255 1255
 		}
1256 1256
 		return self::$_validExtensions = array_merge(self::$_validExtensions, $extensions);
@@ -1263,7 +1263,7 @@  discard block
 block discarded – undo
1263 1263
  */
1264 1264
 	protected static function _loadRoutes() {
1265 1265
 		self::$initialized = true;
1266
-		include APP . 'Config' . DS . 'routes.php';
1266
+		include APP.'Config'.DS.'routes.php';
1267 1267
 	}
1268 1268
 
1269 1269
 }
Please login to merge, or discard this patch.
lib/Cake/Test/Case/Console/AllConsoleTest.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 /**
29 29
  * suite method, defines tests for this suite.
30 30
  *
31
- * @return void
31
+ * @return CakeTestSuite
32 32
  */
33 33
 	public static function suite() {
34 34
 		$suite = new CakeTestSuite('All console classes');
Please login to merge, or discard this patch.
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * AllConsoleTest file
4
- *
5
- * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
6
- * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
7
- *
8
- * Licensed under The MIT License
9
- * For full copyright and license information, please see the LICENSE.txt
10
- * Redistributions of files must retain the above copyright notice.
11
- *
12
- * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
13
- * @link          http://cakephp.org CakePHP(tm) Project
14
- * @package       Cake.Test.Case.Console
15
- * @since         CakePHP(tm) v 2.0
16
- * @license       http://www.opensource.org/licenses/mit-license.php MIT License
17
- */
3
+	 * AllConsoleTest file
4
+	 *
5
+	 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
6
+	 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
7
+	 *
8
+	 * Licensed under The MIT License
9
+	 * For full copyright and license information, please see the LICENSE.txt
10
+	 * Redistributions of files must retain the above copyright notice.
11
+	 *
12
+	 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
13
+	 * @link          http://cakephp.org CakePHP(tm) Project
14
+	 * @package       Cake.Test.Case.Console
15
+	 * @since         CakePHP(tm) v 2.0
16
+	 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
17
+	 */
18 18
 
19 19
 /**
20 20
  * AllConsoleTest class
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,11 +33,11 @@
 block discarded – undo
33 33
 	public static function suite() {
34 34
 		$suite = new CakeTestSuite('All console classes');
35 35
 
36
-		$path = CORE_TEST_CASES . DS . 'Console' . DS;
36
+		$path = CORE_TEST_CASES.DS.'Console'.DS;
37 37
 
38
-		$suite->addTestFile($path . 'AllConsoleLibsTest.php');
39
-		$suite->addTestFile($path . 'AllTasksTest.php');
40
-		$suite->addTestFile($path . 'AllShellsTest.php');
38
+		$suite->addTestFile($path.'AllConsoleLibsTest.php');
39
+		$suite->addTestFile($path.'AllTasksTest.php');
40
+		$suite->addTestFile($path.'AllShellsTest.php');
41 41
 		return $suite;
42 42
 	}
43 43
 }
Please login to merge, or discard this patch.