Skip to content
This repository
Browse code

Fix coding standards errors in Network/

  • Loading branch information...
commit a6da7361494b85411f1b93ea589e58405a77524b 1 parent 863aaad
Mark Story authored March 04, 2012
6  lib/Cake/Network/CakeRequest.php
@@ -29,6 +29,7 @@
29 29
  * @package       Cake.Network
30 30
  */
31 31
 class CakeRequest implements ArrayAccess {
  32
+
32 33
 /**
33 34
  * Array of parameters parsed from the url.
34 35
  *
@@ -275,7 +276,7 @@ protected function _base() {
275 276
 				$base = '';
276 277
 			}
277 278
 
278  
-			$this->webroot = $base .'/';
  279
+			$this->webroot = $base . '/';
279 280
 			return $this->base = $base;
280 281
 		}
281 282
 
@@ -292,7 +293,7 @@ protected function _base() {
292 293
 
293 294
 		if (!empty($base) || !$docRootContainsWebroot) {
294 295
 			if (strpos($this->webroot, '/' . $dir . '/') === false) {
295  
-				$this->webroot .= $dir . '/' ;
  296
+				$this->webroot .= $dir . '/';
296 297
 			}
297 298
 			if (strpos($this->webroot, '/' . $webroot . '/') === false) {
298 299
 				$this->webroot .= $webroot . '/';
@@ -847,4 +848,5 @@ public function offsetExists($name) {
847 848
 	public function offsetUnset($name) {
848 849
 		unset($this->params[$name]);
849 850
 	}
  851
+
850 852
 }
8  lib/Cake/Network/CakeResponse.php
@@ -89,7 +89,7 @@ class CakeResponse {
89 89
 		'cpio' => 'application/x-cpio',
90 90
 		'cpt' => 'application/mac-compactpro',
91 91
 		'csh' => 'application/x-csh',
92  
-		'csv' =>  array('text/csv', 'application/vnd.ms-excel', 'text/plain'),
  92
+		'csv' => array('text/csv', 'application/vnd.ms-excel', 'text/plain'),
93 93
 		'dcr' => 'application/x-director',
94 94
 		'dir' => 'application/x-director',
95 95
 		'dms' => 'application/octet-stream',
@@ -755,7 +755,7 @@ public function sharable($public = null, $time = null) {
755 755
 		if ($time == null) {
756 756
 			$this->_setCacheControl();
757 757
 		}
758  
-		return (bool) $public;
  758
+		return (bool)$public;
759 759
 	}
760 760
 
761 761
 /**
@@ -921,7 +921,7 @@ public function notModified() {
921 921
  **/
922 922
 	public function vary($cacheVariances = null) {
923 923
 		if ($cacheVariances !== null) {
924  
-			$cacheVariances = (array) $cacheVariances;
  924
+			$cacheVariances = (array)$cacheVariances;
925 925
 			$this->_headers['Vary'] = implode(', ', $cacheVariances);
926 926
 		}
927 927
 		if (isset($this->_headers['Vary'])) {
@@ -961,7 +961,6 @@ public function etag($tag = null, $weak = false) {
961 961
 		return null;
962 962
 	}
963 963
 
964  
-
965 964
 /**
966 965
  * Returns a DateTime object initialized at the $time param and using UTC
967 966
  * as timezone
@@ -1151,4 +1150,5 @@ public function cookie($options = null) {
1151 1150
 
1152 1151
 		$this->_cookies[$options['name']] = $options;
1153 1152
 	}
  1153
+
1154 1154
 }
1  lib/Cake/Network/CakeSocket.php
@@ -276,4 +276,5 @@ public function reset($state = null) {
276 276
 		}
277 277
 		return true;
278 278
 	}
  279
+
279 280
 }
14  lib/Cake/Network/Email/CakeEmail.php
@@ -242,7 +242,6 @@ class CakeEmail {
242 242
 /**
243 243
  * Charset the email body is sent in
244 244
  *
245  
- *
246 245
  * @var string
247 246
  */
248 247
 	public $charset = 'utf-8';
@@ -250,15 +249,17 @@ class CakeEmail {
250 249
 /**
251 250
  * Charset the email header is sent in
252 251
  * If null, the $charset property will be used as default
  252
+ *
253 253
  * @var string
254 254
  */
255 255
 	public $headerCharset = null;
256 256
 
257 257
 /**
258 258
  * The application wide charset, used to encode headers and body
  259
+ *
259 260
  * @var string
260 261
  */
261  
-	public $_appCharset = null;
  262
+	protected $_appCharset = null;
262 263
 
263 264
 /**
264 265
  * List of files that should be attached to the email.
@@ -1019,6 +1020,8 @@ public static function deliver($to = null, $subject = null, $message = null, $tr
1019 1020
  * @param CakeEmail $obj CakeEmail
1020 1021
  * @param array $config
1021 1022
  * @return void
  1023
+ * @throws ConfigureException When configuration file cannot be found, or is missing
  1024
+ *   the named config.
1022 1025
  */
1023 1026
 	protected function _applyConfig($config) {
1024 1027
 		if (is_string($config)) {
@@ -1279,7 +1282,7 @@ protected function _attachFiles($boundary = null) {
1279 1282
 	protected function _readFile($file) {
1280 1283
 		$handle = fopen($file, 'rb');
1281 1284
 		$data = fread($handle, filesize($file));
1282  
-		$data = chunk_split(base64_encode($data)) ;
  1285
+		$data = chunk_split(base64_encode($data));
1283 1286
 		fclose($handle);
1284 1287
 		return $data;
1285 1288
 	}
@@ -1359,7 +1362,7 @@ protected function _render($content) {
1359 1362
 			$msg = array_merge($msg, $content);
1360 1363
 			$msg[] = '';
1361 1364
 		}
1362  
-	
  1365
+
1363 1366
 		if (isset($rendered['html'])) {
1364 1367
 			if ($textBoundary !== $boundary || $hasAttachments) {
1365 1368
 				$msg[] = '--' . $textBoundary;
@@ -1451,7 +1454,7 @@ protected function _renderTemplates($content) {
1451 1454
 			$View->set('content', $content);
1452 1455
 			$View->hasRendered = false;
1453 1456
 			$View->viewPath = $View->layoutPath = 'Emails' . DS . $type;
1454  
-	
  1457
+
1455 1458
 			$render = $View->render($template, $layout);
1456 1459
 			$render = str_replace(array("\r\n", "\r"), "\n", $render);
1457 1460
 			$rendered[$type] = $this->_encodeString($render, $this->charset);
@@ -1471,4 +1474,5 @@ protected function _getContentTransferEncoding() {
1471 1474
 		}
1472 1475
 		return '7bit';
1473 1476
 	}
  1477
+
1474 1478
 }
1  lib/Cake/Network/Email/MailTransport.php
@@ -29,6 +29,7 @@ class MailTransport extends AbstractTransport {
29 29
  *
30 30
  * @param CakeEmail $email CakeEmail
31 31
  * @return array
  32
+ * @throws SocketException When mail cannot be sent.
32 33
  */
33 34
 	public function send(CakeEmail $email) {
34 35
 		$eol = PHP_EOL;
1  lib/Cake/Network/Http/DigestAuthentication.php
@@ -101,4 +101,5 @@ protected static function _generateHeader(HttpSocket $http, &$authInfo) {
101 101
 		}
102 102
 		return $authHeader;
103 103
 	}
  104
+
104 105
 }
8  lib/Cake/Network/Http/HttpResponse.php
@@ -123,7 +123,7 @@ public function getHeader($name, $headers = null) {
123 123
 	public function isOk() {
124 124
 		return $this->code == 200;
125 125
 	}
126  
-	
  126
+
127 127
 /**
128 128
  * If return is a valid 3xx (Redirection)
129 129
  *
@@ -238,9 +238,7 @@ protected function _decodeChunkedBody($body) {
238 238
 			$chunkLength = hexdec($hexLength);
239 239
 			$chunk = substr($body, 0, $chunkLength);
240 240
 			if (!empty($chunkExtensionName)) {
241  
-				/**
242  
-				 * @todo See if there are popular chunk extensions we should implement
243  
-				 */
  241
+				 // @todo See if there are popular chunk extensions we should implement
244 242
 			}
245 243
 			$decodedBody .= $chunk;
246 244
 			if ($chunkLength !== 0) {
@@ -427,7 +425,6 @@ public function offsetGet($offset) {
427 425
  * @return void
428 426
  */
429 427
 	public function offsetSet($offset, $value) {
430  
-		return;
431 428
 	}
432 429
 
433 430
 /**
@@ -437,7 +434,6 @@ public function offsetSet($offset, $value) {
437 434
  * @return void
438 435
  */
439 436
 	public function offsetUnset($offset) {
440  
-		return;
441 437
 	}
442 438
 
443 439
 /**
3  lib/Cake/Network/Http/HttpSocket.php
@@ -603,7 +603,7 @@ protected function _setProxy() {
603 603
 		}
604 604
 		list($plugin, $authClass) = pluginSplit($this->_proxy['method'], true);
605 605
 		$authClass = Inflector::camelize($authClass) . 'Authentication';
606  
-		App::uses($authClass, $plugin. 'Network/Http');
  606
+		App::uses($authClass, $plugin . 'Network/Http');
607 607
 
608 608
 		if (!class_exists($authClass)) {
609 609
 			throw new SocketException(__d('cake_dev', 'Unknown authentication method for proxy.'));
@@ -926,4 +926,5 @@ public function reset($full = true) {
926 926
 		parent::reset($initalState);
927 927
 		return true;
928 928
 	}
  929
+
929 930
 }

5 notes on commit a6da736

Mark
Collaborator

What kind of CodeSniffer are you using for the corrections? Will that be partly open source for user land code, as well?

Jose Diaz-Gonzalez
Collaborator

I believe he is using https://github.com/markstory/CodeSniffer_CakePHP. Don't quote me on that.

Mark
Collaborator

thx. even more interesting would be how to get the sniffer to automatically correct those smells (manually would probably drive you insane for more files and is not worth it). shouldn't be too difficult to accomplish.

Mark Story
Owner

I'm using the codesniffer in my repo as @josegonzalez mentioned, and it is and will be available. I'm not done tweaking all the rules yet, which is why there is no release. Once I'm done with it I was going to make a pear package so its easier to install and use with phpcs which is the tool I'm using.

Please sign in to comment.
Something went wrong with that request. Please try again.