Permalink
Browse files

Fix coding standards errors in Network/

  • Loading branch information...
markstory committed Mar 4, 2012
1 parent 863aaad commit a6da7361494b85411f1b93ea589e58405a77524b
@@ -29,6 +29,7 @@
* @package Cake.Network
*/
class CakeRequest implements ArrayAccess {
+
/**
* Array of parameters parsed from the url.
*
@@ -275,7 +276,7 @@ protected function _base() {
$base = '';
}
- $this->webroot = $base .'/';
+ $this->webroot = $base . '/';
return $this->base = $base;
}
@@ -292,7 +293,7 @@ protected function _base() {
if (!empty($base) || !$docRootContainsWebroot) {
if (strpos($this->webroot, '/' . $dir . '/') === false) {
- $this->webroot .= $dir . '/' ;
+ $this->webroot .= $dir . '/';
}
if (strpos($this->webroot, '/' . $webroot . '/') === false) {
$this->webroot .= $webroot . '/';
@@ -847,4 +848,5 @@ public function offsetExists($name) {
public function offsetUnset($name) {
unset($this->params[$name]);
}
+
}
@@ -89,7 +89,7 @@ class CakeResponse {
'cpio' => 'application/x-cpio',
'cpt' => 'application/mac-compactpro',
'csh' => 'application/x-csh',
- 'csv' => array('text/csv', 'application/vnd.ms-excel', 'text/plain'),
+ 'csv' => array('text/csv', 'application/vnd.ms-excel', 'text/plain'),
'dcr' => 'application/x-director',
'dir' => 'application/x-director',
'dms' => 'application/octet-stream',
@@ -755,7 +755,7 @@ public function sharable($public = null, $time = null) {
if ($time == null) {
$this->_setCacheControl();
}
- return (bool) $public;
+ return (bool)$public;
}
/**
@@ -921,7 +921,7 @@ public function notModified() {
**/
public function vary($cacheVariances = null) {
if ($cacheVariances !== null) {
- $cacheVariances = (array) $cacheVariances;
+ $cacheVariances = (array)$cacheVariances;
$this->_headers['Vary'] = implode(', ', $cacheVariances);
}
if (isset($this->_headers['Vary'])) {
@@ -961,7 +961,6 @@ public function etag($tag = null, $weak = false) {
return null;
}
-
/**
* Returns a DateTime object initialized at the $time param and using UTC
* as timezone
@@ -1151,4 +1150,5 @@ public function cookie($options = null) {
$this->_cookies[$options['name']] = $options;
}
+
}
@@ -276,4 +276,5 @@ public function reset($state = null) {
}
return true;
}
+
}
@@ -242,23 +242,24 @@ class CakeEmail {
/**
* Charset the email body is sent in
*
- *
* @var string
*/
public $charset = 'utf-8';
/**
* Charset the email header is sent in
* If null, the $charset property will be used as default
+ *
* @var string
*/
public $headerCharset = null;
/**
* The application wide charset, used to encode headers and body
+ *
* @var string
*/
- public $_appCharset = null;
+ protected $_appCharset = null;
/**
* 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
* @param CakeEmail $obj CakeEmail
* @param array $config
* @return void
+ * @throws ConfigureException When configuration file cannot be found, or is missing
+ * the named config.
*/
protected function _applyConfig($config) {
if (is_string($config)) {
@@ -1279,7 +1282,7 @@ protected function _attachFiles($boundary = null) {
protected function _readFile($file) {
$handle = fopen($file, 'rb');
$data = fread($handle, filesize($file));
- $data = chunk_split(base64_encode($data)) ;
+ $data = chunk_split(base64_encode($data));
fclose($handle);
return $data;
}
@@ -1359,7 +1362,7 @@ protected function _render($content) {
$msg = array_merge($msg, $content);
$msg[] = '';
}
-
+
if (isset($rendered['html'])) {
if ($textBoundary !== $boundary || $hasAttachments) {
$msg[] = '--' . $textBoundary;
@@ -1451,7 +1454,7 @@ protected function _renderTemplates($content) {
$View->set('content', $content);
$View->hasRendered = false;
$View->viewPath = $View->layoutPath = 'Emails' . DS . $type;
-
+
$render = $View->render($template, $layout);
$render = str_replace(array("\r\n", "\r"), "\n", $render);
$rendered[$type] = $this->_encodeString($render, $this->charset);
@@ -1471,4 +1474,5 @@ protected function _getContentTransferEncoding() {
}
return '7bit';
}
+
}
@@ -29,6 +29,7 @@ class MailTransport extends AbstractTransport {
*
* @param CakeEmail $email CakeEmail
* @return array
+ * @throws SocketException When mail cannot be sent.
*/
public function send(CakeEmail $email) {
$eol = PHP_EOL;
@@ -101,4 +101,5 @@ protected static function _generateHeader(HttpSocket $http, &$authInfo) {
}
return $authHeader;
}
+
}
@@ -123,7 +123,7 @@ public function getHeader($name, $headers = null) {
public function isOk() {
return $this->code == 200;
}
-
+
/**
* If return is a valid 3xx (Redirection)
*
@@ -238,9 +238,7 @@ protected function _decodeChunkedBody($body) {
$chunkLength = hexdec($hexLength);
$chunk = substr($body, 0, $chunkLength);
if (!empty($chunkExtensionName)) {
- /**
- * @todo See if there are popular chunk extensions we should implement
- */
+ // @todo See if there are popular chunk extensions we should implement
}
$decodedBody .= $chunk;
if ($chunkLength !== 0) {
@@ -427,7 +425,6 @@ public function offsetGet($offset) {
* @return void
*/
public function offsetSet($offset, $value) {
- return;
}
/**
@@ -437,7 +434,6 @@ public function offsetSet($offset, $value) {
* @return void
*/
public function offsetUnset($offset) {
- return;
}
/**
@@ -603,7 +603,7 @@ protected function _setProxy() {
}
list($plugin, $authClass) = pluginSplit($this->_proxy['method'], true);
$authClass = Inflector::camelize($authClass) . 'Authentication';
- App::uses($authClass, $plugin. 'Network/Http');
+ App::uses($authClass, $plugin . 'Network/Http');
if (!class_exists($authClass)) {
throw new SocketException(__d('cake_dev', 'Unknown authentication method for proxy.'));
@@ -926,4 +926,5 @@ public function reset($full = true) {
parent::reset($initalState);
return true;
}
+
}

5 comments on commit a6da736

@dereuromark

This comment has been minimized.

Show comment
Hide comment
@dereuromark

dereuromark Mar 4, 2012

Member

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

Member

dereuromark replied Mar 4, 2012

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

@josegonzalez

This comment has been minimized.

Show comment
Hide comment
@josegonzalez

josegonzalez Mar 4, 2012

Member

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

Member

josegonzalez replied Mar 4, 2012

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

@dereuromark

This comment has been minimized.

Show comment
Hide comment
@dereuromark

dereuromark Mar 4, 2012

Member

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.

Member

dereuromark replied Mar 4, 2012

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.

@josegonzalez

This comment has been minimized.

Show comment
Hide comment
@markstory

This comment has been minimized.

Show comment
Hide comment
@markstory

markstory Mar 4, 2012

Member

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.

Member

markstory replied Mar 4, 2012

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.