mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Improve documentation and code style
This commit is contained in:
parent
320cdf98ee
commit
261a99c0e3
2 changed files with 17 additions and 13 deletions
|
@ -712,7 +712,7 @@ class Controller extends CakeObject implements CakeEventListener {
|
||||||
* 800 => 'Unexpected Minotaur'
|
* 800 => 'Unexpected Minotaur'
|
||||||
* )); // sets these new values, and returns true
|
* )); // sets these new values, and returns true
|
||||||
*
|
*
|
||||||
* @return array Associative array of the HTTP codes as keys, and the message
|
* @return array|null|true Associative array of the HTTP codes as keys, and the message
|
||||||
* strings as values, or null of the given $code does not exist.
|
* strings as values, or null of the given $code does not exist.
|
||||||
* @deprecated 3.0.0 Since 2.4. Will be removed in 3.0. Use CakeResponse::httpCodes().
|
* @deprecated 3.0.0 Since 2.4. Will be removed in 3.0. Use CakeResponse::httpCodes().
|
||||||
*/
|
*/
|
||||||
|
@ -757,7 +757,7 @@ class Controller extends CakeObject implements CakeEventListener {
|
||||||
*
|
*
|
||||||
* @param string|array $url A string or array-based URL pointing to another location within the app,
|
* @param string|array $url A string or array-based URL pointing to another location within the app,
|
||||||
* or an absolute URL
|
* or an absolute URL
|
||||||
* @param int|array|null $status HTTP status code (eg: 301). Defaults to 302 when null is passed.
|
* @param int|array|null|string $status HTTP status code (eg: 301). Defaults to 302 when null is passed.
|
||||||
* @param bool $exit If true, exit() will be called after the redirect
|
* @param bool $exit If true, exit() will be called after the redirect
|
||||||
* @return CakeResponse|null
|
* @return CakeResponse|null
|
||||||
* @triggers Controller.beforeRedirect $this, array($url, $status, $exit)
|
* @triggers Controller.beforeRedirect $this, array($url, $status, $exit)
|
||||||
|
@ -905,7 +905,7 @@ class Controller extends CakeObject implements CakeEventListener {
|
||||||
*
|
*
|
||||||
* `$errors = $this->validateErrors($this->Article, $this->User);`
|
* `$errors = $this->validateErrors($this->Article, $this->User);`
|
||||||
*
|
*
|
||||||
* @return array Validation errors, or false if none
|
* @return array|false Validation errors, or false if none
|
||||||
* @deprecated 3.0.0 This method will be removed in 3.0
|
* @deprecated 3.0.0 This method will be removed in 3.0
|
||||||
*/
|
*/
|
||||||
public function validateErrors() {
|
public function validateErrors() {
|
||||||
|
|
|
@ -374,7 +374,7 @@ class CakeResponse {
|
||||||
* Holds all the cache directives that will be converted
|
* Holds all the cache directives that will be converted
|
||||||
* into headers when sending the request
|
* into headers when sending the request
|
||||||
*
|
*
|
||||||
* @var string
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $_cacheDirectives = array();
|
protected $_cacheDirectives = array();
|
||||||
|
|
||||||
|
@ -672,8 +672,9 @@ class CakeResponse {
|
||||||
*
|
*
|
||||||
* For more on HTTP status codes see: http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1
|
* For more on HTTP status codes see: http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1
|
||||||
*
|
*
|
||||||
* @return mixed associative array of the HTTP codes as keys, and the message
|
* @return array|null|true associative array of the HTTP codes as keys, and the message
|
||||||
* strings as values, or null of the given $code does not exist.
|
* strings as values, or null of the given $code does not exist. `true` if `$code` is
|
||||||
|
* an array of valid codes.
|
||||||
* @throws CakeException If an attempt is made to add an invalid status code
|
* @throws CakeException If an attempt is made to add an invalid status code
|
||||||
*/
|
*/
|
||||||
public function httpCodes($code = null) {
|
public function httpCodes($code = null) {
|
||||||
|
@ -717,7 +718,7 @@ class CakeResponse {
|
||||||
*
|
*
|
||||||
* e.g `type(array('jpg' => 'text/plain'));`
|
* e.g `type(array('jpg' => 'text/plain'));`
|
||||||
*
|
*
|
||||||
* @param string $contentType Content type key.
|
* @param array|string $contentType Content type key.
|
||||||
* @return mixed current content type or false if supplied an invalid content type
|
* @return mixed current content type or false if supplied an invalid content type
|
||||||
*/
|
*/
|
||||||
public function type($contentType = null) {
|
public function type($contentType = null) {
|
||||||
|
@ -854,7 +855,7 @@ class CakeResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->maxAge($time);
|
$this->maxAge($time);
|
||||||
if (!$time) {
|
if ($time === null) {
|
||||||
$this->_setCacheControl();
|
$this->_setCacheControl();
|
||||||
}
|
}
|
||||||
return (bool)$public;
|
return (bool)$public;
|
||||||
|
@ -1160,7 +1161,11 @@ class CakeResponse {
|
||||||
* @return bool whether the response was marked as not modified or not.
|
* @return bool whether the response was marked as not modified or not.
|
||||||
*/
|
*/
|
||||||
public function checkNotModified(CakeRequest $request) {
|
public function checkNotModified(CakeRequest $request) {
|
||||||
$etags = preg_split('/\s*,\s*/', $request->header('If-None-Match'), null, PREG_SPLIT_NO_EMPTY);
|
$ifNoneMatchHeader = $request->header('If-None-Match');
|
||||||
|
$etags = array();
|
||||||
|
if (is_string($ifNoneMatchHeader)) {
|
||||||
|
$etags = preg_split('/\s*,\s*/', $ifNoneMatchHeader, null, PREG_SPLIT_NO_EMPTY);
|
||||||
|
}
|
||||||
$modifiedSince = $request->header('If-Modified-Since');
|
$modifiedSince = $request->header('If-Modified-Since');
|
||||||
$checks = array();
|
$checks = array();
|
||||||
if ($responseTag = $this->etag()) {
|
if ($responseTag = $this->etag()) {
|
||||||
|
@ -1224,7 +1229,7 @@ class CakeResponse {
|
||||||
*
|
*
|
||||||
* `$this->cookie((array) $options)`
|
* `$this->cookie((array) $options)`
|
||||||
*
|
*
|
||||||
* @param array $options Either null to get all cookies, string for a specific cookie
|
* @param array|string $options Either null to get all cookies, string for a specific cookie
|
||||||
* or array to set cookie.
|
* or array to set cookie.
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
|
@ -1312,8 +1317,7 @@ class CakeResponse {
|
||||||
$result[] = array('preg' => '@.@', 'original' => '*');
|
$result[] = array('preg' => '@.@', 'original' => '*');
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
$original = $domain;
|
||||||
$original = $preg = $domain;
|
|
||||||
if (strpos($domain, '://') === false) {
|
if (strpos($domain, '://') === false) {
|
||||||
$preg = ($requestIsSSL ? 'https://' : 'http://') . $domain;
|
$preg = ($requestIsSSL ? 'https://' : 'http://') . $domain;
|
||||||
}
|
}
|
||||||
|
@ -1464,7 +1468,7 @@ class CakeResponse {
|
||||||
$file->open('rb');
|
$file->open('rb');
|
||||||
|
|
||||||
$end = $start = false;
|
$end = $start = false;
|
||||||
if ($range) {
|
if (!empty($range)) {
|
||||||
list($start, $end) = $range;
|
list($start, $end) = $range;
|
||||||
}
|
}
|
||||||
if ($start !== false) {
|
if ($start !== false) {
|
||||||
|
|
Loading…
Reference in a new issue