From 8c8b1a0999b47fc84407b5ab4b9fbb2591e95380 Mon Sep 17 00:00:00 2001 From: ADmad Date: Tue, 27 May 2014 20:24:48 +0530 Subject: [PATCH] CS fixes. --- src/Datasource/ConnectionRegistry.php | 1 + src/Error/BaseErrorHandler.php | 10 +++++----- src/Error/Exception.php | 2 +- src/Error/ExceptionRenderer.php | 4 ++-- src/Error/FatalErrorException.php | 8 ++++---- src/Error/NotImplementedException.php | 6 ++++++ src/Model/ModelAwareTrait.php | 2 +- src/Network/Email/AbstractTransport.php | 6 ++---- src/Network/Email/SmtpTransport.php | 4 +--- src/Network/Http/Auth/Basic.php | 12 ++++++------ src/Network/Http/FormData.php | 1 + src/Network/Http/Response.php | 7 ++++--- src/Network/Request.php | 6 +++--- src/Network/Response.php | 21 ++++++++++----------- src/Network/Session.php | 14 ++++++++------ src/Network/Socket.php | 6 ++---- src/Routing/DispatcherFilter.php | 2 ++ src/Routing/Filter/AssetFilter.php | 2 +- src/Routing/RouteCollection.php | 3 ++- src/Routing/Router.php | 4 ++-- src/View/Widget/Basic.php | 2 +- 21 files changed, 65 insertions(+), 58 deletions(-) diff --git a/src/Datasource/ConnectionRegistry.php b/src/Datasource/ConnectionRegistry.php index 894a0f8efca..5399169f758 100644 --- a/src/Datasource/ConnectionRegistry.php +++ b/src/Datasource/ConnectionRegistry.php @@ -47,6 +47,7 @@ protected function _resolveClassName($class) { * * @param string $class The classname that is missing. * @param string $plugin The plugin the driver is missing in. + * @return void * @throws \Cake\Datasource\Error\MissingDatasourceException */ protected function _throwMissingClassError($class, $plugin) { diff --git a/src/Error/BaseErrorHandler.php b/src/Error/BaseErrorHandler.php index 5faf9200af1..e7ce56b1272 100644 --- a/src/Error/BaseErrorHandler.php +++ b/src/Error/BaseErrorHandler.php @@ -142,12 +142,12 @@ public function handleError($code, $description, $file = null, $line = null, $co * Uses a template method provided by subclasses to display errors in an * environment appropriate way. * - * @param \Exception $exception + * @param \Exception $exception Exception instance. * @return void * @throws Exception When renderer class not found * @see http://php.net/manual/en/function.set-exception-handler.php */ - public function handleException($exception) { + public function handleException(\Exception $exception) { $this->_displayException($exception); $this->_logException($exception); $this->_stop($exception->getCode() ?: 1); @@ -224,10 +224,10 @@ protected function _logError($level, $data) { /** * Handles exception logging * - * @param Exception $exception + * @param Exception $exception Exception instance. * @return bool */ - protected function _logException($exception) { + protected function _logException(\Exception $exception) { $config = $this->_options; if (empty($config['log'])) { return false; @@ -249,7 +249,7 @@ protected function _logException($exception) { * @param Exception $exception Exception instance * @return string Formatted message */ - protected function _getMessage($exception) { + protected function _getMessage(\Exception $exception) { $message = sprintf("[%s] %s", get_class($exception), $exception->getMessage() diff --git a/src/Error/Exception.php b/src/Error/Exception.php index a829a0ec3bb..190919f30f2 100644 --- a/src/Error/Exception.php +++ b/src/Error/Exception.php @@ -73,7 +73,7 @@ public function getAttributes() { * * See also Cake\Network\Response::header() * - * @param string|array $header. An array of header strings or a single header string + * @param string|array $header An array of header strings or a single header string * - an associative array of "header name" => "header value" * - an array of string headers is also accepted * @param string $value The header value. diff --git a/src/Error/ExceptionRenderer.php b/src/Error/ExceptionRenderer.php index b6785bafc69..9abd9da18b0 100644 --- a/src/Error/ExceptionRenderer.php +++ b/src/Error/ExceptionRenderer.php @@ -159,7 +159,7 @@ public function render() { /** * Get method name * - * @param \Exception $exception + * @param \Exception $exception Exception instance. * @return string */ protected function _method(\Exception $exception) { @@ -195,7 +195,7 @@ protected function _message(\Exception $exception, $code) { /** * Get template for rendering exception info. * - * @param \Exception $exception + * @param \Exception $exception Exception instance. * @param string $method Method name * @param int $code Error code * @return string Template name diff --git a/src/Error/FatalErrorException.php b/src/Error/FatalErrorException.php index 21a7c33a8e5..734ed209ea9 100644 --- a/src/Error/FatalErrorException.php +++ b/src/Error/FatalErrorException.php @@ -22,10 +22,10 @@ class FatalErrorException extends Exception { /** * Constructor * - * @param string $message - * @param int $code - * @param string $file - * @param int $line + * @param string $message Message string. + * @param int $code Code. + * @param string $file File name. + * @param int $line Line number. */ public function __construct($message, $code = 500, $file = null, $line = null) { parent::__construct($message, $code); diff --git a/src/Error/NotImplementedException.php b/src/Error/NotImplementedException.php index 52db98210cc..32bf0b566fe 100644 --- a/src/Error/NotImplementedException.php +++ b/src/Error/NotImplementedException.php @@ -19,8 +19,14 @@ */ class NotImplementedException extends Exception { +/** + * {@inheritDoc} + */ protected $_messageTemplate = '%s is not implemented.'; +/** + * {@inheritDoc} + */ public function __construct($message, $code = 501) { parent::__construct($message, $code); } diff --git a/src/Model/ModelAwareTrait.php b/src/Model/ModelAwareTrait.php index 086fb40f37a..c57ab9e2292 100644 --- a/src/Model/ModelAwareTrait.php +++ b/src/Model/ModelAwareTrait.php @@ -48,7 +48,7 @@ trait ModelAwareTrait { * * If the properties are already set they will not be overwritten * - * @param string $name + * @param string $name Class name. * @return void */ protected function _setModelClass($name) { diff --git a/src/Network/Email/AbstractTransport.php b/src/Network/Email/AbstractTransport.php index 61d8eb59193..86a8fcea8b4 100644 --- a/src/Network/Email/AbstractTransport.php +++ b/src/Network/Email/AbstractTransport.php @@ -1,7 +1,5 @@ value - * @param string $eol + * @param string $eol End of line string. * @return string */ protected function _headersToString($headers, $eol = "\r\n") { diff --git a/src/Network/Email/SmtpTransport.php b/src/Network/Email/SmtpTransport.php index 060c4b87f34..c287c1217ff 100644 --- a/src/Network/Email/SmtpTransport.php +++ b/src/Network/Email/SmtpTransport.php @@ -1,7 +1,5 @@ 'message'` format. * - * @param array $responseLines + * @param array $responseLines Response to parse. * @return void */ protected function _bufferResponseLines(array $responseLines) { diff --git a/src/Network/Http/Auth/Basic.php b/src/Network/Http/Auth/Basic.php index 960e60df3f0..5eb2edb0515 100644 --- a/src/Network/Http/Auth/Basic.php +++ b/src/Network/Http/Auth/Basic.php @@ -26,8 +26,8 @@ class Basic { /** * Add Authorization header to the request. * - * @param Request $request - * @param array $credentials + * @param Cake\Network\Request $request Request instance. + * @param array $credentials Credentials. * @return void * @see http://www.ietf.org/rfc/rfc2617.txt */ @@ -41,8 +41,8 @@ public function authentication(Request $request, array $credentials) { /** * Proxy Authentication * - * @param Request $request - * @param array $credentials + * @param Cake\Network\Request $request Request instance. + * @param array $credentials Credentials. * @return void * @see http://www.ietf.org/rfc/rfc2617.txt */ @@ -56,8 +56,8 @@ public function proxyAuthentication(Request $request, array $credentials) { /** * Generate basic [proxy] authentication header * - * @param string $user - * @param string $pass + * @param string $user Username. + * @param string $pass Password. * @return string */ protected function _generateHeader($user, $pass) { diff --git a/src/Network/Http/FormData.php b/src/Network/Http/FormData.php index 44d271acb85..714a80ebf5a 100644 --- a/src/Network/Http/FormData.php +++ b/src/Network/Http/FormData.php @@ -93,6 +93,7 @@ public function add($name, $value) { * Add multiple parts at once. * * Iterates the parameter and adds all the key/values. + * * @param array $data Array of data to add. * @return FormData this */ diff --git a/src/Network/Http/Response.php b/src/Network/Http/Response.php index e59fd1eee76..3626ddb3722 100644 --- a/src/Network/Http/Response.php +++ b/src/Network/Http/Response.php @@ -134,7 +134,8 @@ public function __construct($headers = [], $body = '') { * - Decodes the status code. * - Parses and normalizes header names + values. * - * @param array $headers + * @param array $headers Headers to parse. + * @return void */ protected function _parseHeaders($headers) { foreach ($headers as $key => $value) { @@ -358,7 +359,7 @@ protected function _getXml() { /** * Read values as properties. * - * @param string $name + * @param string $name Property name. * @return mixed */ public function __get($name) { @@ -375,7 +376,7 @@ public function __get($name) { /** * isset/empty test with -> syntax. * - * @param string $name + * @param string $name Property name. * @return bool */ public function __isset($name) { diff --git a/src/Network/Request.php b/src/Network/Request.php index 08d2b46d486..5722efa781f 100644 --- a/src/Network/Request.php +++ b/src/Network/Request.php @@ -291,7 +291,7 @@ protected function _processGet($query) { * by PHP. Following that, REQUEST_URI, PHP_SELF, HTTP_X_REWRITE_URL and argv are checked in that order. * Each of these server variables have the base path, and query strings stripped off * - * @param array $config + * @param array $config Configuration to set. * @return string URI The CakePHP request path that is being accessed. */ protected static function _url($config) { @@ -416,7 +416,7 @@ protected function _processFiles($post, $files) { * Recursively walks the FILES array restructuring the data * into something sane and useable. * - * @param array $post The post data having files inserted into + * @param array &$post The post data having files inserted into * @param string $path The dot separated path to insert $data into. * @param array $data The data to traverse/insert. * @param string $field The terminal field name, which is the top level key in $_FILES. @@ -896,7 +896,7 @@ public function acceptLanguage($language = null) { * Only qualifiers will be extracted, any other accept extensions will be * discarded as they are not frequently used. * - * @param string $header + * @param string $header Header string. * @return array */ protected function _parseAcceptWithQualifier($header) { diff --git a/src/Network/Response.php b/src/Network/Response.php index 7ed2f30c971..f2f8d78b423 100644 --- a/src/Network/Response.php +++ b/src/Network/Response.php @@ -1,7 +1,5 @@ "header value" is also accepted * - an array of string headers is also accepted - * @param string|array $value. The header value(s) + * @param string|array $value The header value(s) * @return array list of headers to be sent */ public function header($header = null, $value = null) { @@ -588,6 +586,7 @@ public function header($header = null, $value = null) { * Acccessor for the location header. * * Get/Set the Location header value. + * * @param null|string $url Either null to get the current location, or a string to set one. * @return string|null When setting the location null will be returned. When reading the location * a string of the current location header value (if any) will be returned. @@ -704,7 +703,7 @@ public function httpCodes($code = null) { * * e.g `type(array('jpg' => 'text/plain'));` * - * @param string $contentType + * @param string $contentType Content type. * @return mixed current content type or false if supplied an invalid content type */ public function type($contentType = null) { @@ -767,7 +766,7 @@ public function mapType($ctype) { * Sets the response charset * if $charset is null the current charset is returned * - * @param string $charset + * @param string $charset Character set. * @return string current charset */ public function charset($charset = null) { @@ -936,7 +935,7 @@ protected function _setCacheControl() { * `$response->expires(new DateTime('+1 day'))` Will set the expiration in next 24 hours * `$response->expires()` Will return the current expiration header value * - * @param string|\DateTime $time + * @param string|\DateTime $time Valid time string or \DateTime instance. * @return string */ public function expires($time = null) { @@ -960,7 +959,7 @@ public function expires($time = null) { * `$response->modified(new DateTime('+1 day'))` Will set the modification date in the past 24 hours * `$response->modified()` Will return the current Last-Modified header value * - * @param string|\DateTime $time + * @param string|\DateTime $time Valid time string or \Datatime instance. * @return string */ public function modified($time = null) { @@ -1054,7 +1053,7 @@ public function etag($hash = null, $weak = false) { * Returns a DateTime object initialized at the $time param and using UTC * as timezone * - * @param string|int|\DateTime $time + * @param string|int|\DateTime $time Valid time string or \Datatime instance. * @return \DateTime */ protected function _getUTCDate($time = null) { @@ -1289,8 +1288,8 @@ public function cors(Request $request, $allowedDomains, $allowedMethods = array( /** * Normalize the origin to regular expressions and put in an array format * - * @param array $domains - * @param bool $requestIsSSL + * @param array $domains Domain names. + * @param bool $requestIsSSL Whether it's a SSL request. * @return array */ protected function _normalizeCorsDomains($domains, $requestIsSSL = false) { diff --git a/src/Network/Session.php b/src/Network/Session.php index 8224e2f200d..466230482d5 100644 --- a/src/Network/Session.php +++ b/src/Network/Session.php @@ -86,7 +86,7 @@ class Session { * - ini: A list of php.ini directives to set before the session starts. * - timeout: The time in minutes the session should stay active * - * @param array $sessionConfig + * @param array $sessionConfig Session config. * @return Cake\Network\Session * @see Session::__construct() */ @@ -120,7 +120,7 @@ public static function create($sessionConfig = []) { /** * Get one of the prebaked default session configurations. * - * @param string $name + * @param string $name Config name. * @return bool|array */ protected static function _defaultConfig($name) { @@ -189,7 +189,7 @@ protected static function _defaultConfig($name) { * the configuration array for the engine. You can set the `class` key to an already * instantiated session handler object. * - * @param array The Configuration to apply to this session object + * @param array $config The Configuration to apply to this session object */ public function __construct(array $config = []) { if (isset($config['timeout'])) { @@ -267,6 +267,7 @@ public function engine($class = null, $options = []) { * * `$session->options(['session.use_cookies' => 1]);` * + * @param array $options Ini options to set. * @return void * @throws \RuntimeException if any directive could not be set */ @@ -349,10 +350,10 @@ public function check($name = null) { if ($this->_hasSession() && !$this->started()) { $this->start(); } - + if (!isset($_SESSION)) { return null; - } + } return Hash::get($_SESSION, $name) !== null; } @@ -450,7 +451,7 @@ public function delete($name) { /** * Used to write new data to _SESSION, since PHP doesn't like us setting the _SESSION var itself. * - * @param array $old Set of old variables => values + * @param array &$old Set of old variables => values * @param array $new New set of variable => value * @return void */ @@ -497,6 +498,7 @@ public function clear() { /** * Returns whether a session exists + * * @return bool */ protected function _hasSession() { diff --git a/src/Network/Socket.php b/src/Network/Socket.php index f70bdd11f9b..b969034ff24 100644 --- a/src/Network/Socket.php +++ b/src/Network/Socket.php @@ -1,7 +1,5 @@ _templates = $templates;