Skip to content

Commit

Permalink
CS fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed May 27, 2014
1 parent efe6c05 commit 8c8b1a0
Show file tree
Hide file tree
Showing 21 changed files with 65 additions and 58 deletions.
1 change: 1 addition & 0 deletions src/Datasource/ConnectionRegistry.php
Expand Up @@ -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) {
Expand Down
10 changes: 5 additions & 5 deletions src/Error/BaseErrorHandler.php
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/Error/Exception.php
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/Error/ExceptionRenderer.php
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/Error/FatalErrorException.php
Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions src/Error/NotImplementedException.php
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Model/ModelAwareTrait.php
Expand Up @@ -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) {
Expand Down
6 changes: 2 additions & 4 deletions src/Network/Email/AbstractTransport.php
@@ -1,7 +1,5 @@
<?php
/**
* Abstract send email
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
Expand Down Expand Up @@ -36,7 +34,7 @@ abstract class AbstractTransport {
/**
* Send mail
*
* @param \Cake\Network\Email\Email $email
* @param \Cake\Network\Email\Email $email Email instance.
* @return array
*/
abstract public function send(Email $email);
Expand All @@ -54,7 +52,7 @@ public function __construct($config = []) {
* Help to convert headers in string
*
* @param array $headers Headers in format key => value
* @param string $eol
* @param string $eol End of line string.
* @return string
*/
protected function _headersToString($headers, $eol = "\r\n") {
Expand Down
4 changes: 1 addition & 3 deletions src/Network/Email/SmtpTransport.php
@@ -1,7 +1,5 @@
<?php
/**
* Send mail using SMTP protocol
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
Expand Down Expand Up @@ -118,7 +116,7 @@ public function send(Email $email) {
/**
* Parses and stores the reponse lines in `'code' => 'message'` format.
*
* @param array $responseLines
* @param array $responseLines Response to parse.
* @return void
*/
protected function _bufferResponseLines(array $responseLines) {
Expand Down
12 changes: 6 additions & 6 deletions src/Network/Http/Auth/Basic.php
Expand Up @@ -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
*/
Expand All @@ -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
*/
Expand All @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions src/Network/Http/FormData.php
Expand Up @@ -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
*/
Expand Down
7 changes: 4 additions & 3 deletions src/Network/Http/Response.php
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions src/Network/Request.php
Expand Up @@ -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) {
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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) {
Expand Down
21 changes: 10 additions & 11 deletions src/Network/Response.php
@@ -1,7 +1,5 @@
<?php
/**
* Cake Response
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
Expand Down Expand Up @@ -561,10 +559,10 @@ protected function _sendContent($content) {
* e.g `header('WWW-Authenticate: Negotiate'); header('WWW-Authenticate: Not-Negotiate');`
* will have the same effect as only doing `header('WWW-Authenticate: Not-Negotiate');`
*
* @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" 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) {
Expand All @@ -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.
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
14 changes: 8 additions & 6 deletions src/Network/Session.php
Expand Up @@ -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()
*/
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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'])) {
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -497,6 +498,7 @@ public function clear() {

/**
* Returns whether a session exists
*
* @return bool
*/
protected function _hasSession() {
Expand Down

0 comments on commit 8c8b1a0

Please sign in to comment.