mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-16 07:11:19 +08:00
Added back some toArray() implementations.
This commit is contained in:
@ -145,6 +145,9 @@ class ErrorHandler extends Component
|
|||||||
'message' => $exception->getMessage(),
|
'message' => $exception->getMessage(),
|
||||||
'code' => $exception->getCode(),
|
'code' => $exception->getCode(),
|
||||||
];
|
];
|
||||||
|
if ($exception instanceof HttpException) {
|
||||||
|
$array['status'] = $exception->statusCode;
|
||||||
|
}
|
||||||
if (($prev = $exception->getPrevious()) !== null) {
|
if (($prev = $exception->getPrevious()) !== null) {
|
||||||
$array['previous'] = $this->convertExceptionToArray($prev);
|
$array['previous'] = $this->convertExceptionToArray($prev);
|
||||||
}
|
}
|
||||||
|
@ -165,6 +165,16 @@ class CookieCollection extends Object implements \IteratorAggregate, \ArrayAcces
|
|||||||
$this->_cookies = [];
|
$this->_cookies = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the collection as a PHP array.
|
||||||
|
* @return array the array representation of the collection.
|
||||||
|
* The array keys are cookie names, and the array values are the corresponding cookie objects.
|
||||||
|
*/
|
||||||
|
public function toArray()
|
||||||
|
{
|
||||||
|
return $this->_cookies;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether there is a cookie with the specified name.
|
* Returns whether there is a cookie with the specified name.
|
||||||
* This method is required by the SPL interface `ArrayAccess`.
|
* This method is required by the SPL interface `ArrayAccess`.
|
||||||
|
@ -159,6 +159,16 @@ class HeaderCollection extends Object implements \IteratorAggregate, \ArrayAcces
|
|||||||
$this->_headers = [];
|
$this->_headers = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the collection as a PHP array.
|
||||||
|
* @return array the array representation of the collection.
|
||||||
|
* The array keys are header names, and the array values are the corresponding header values.
|
||||||
|
*/
|
||||||
|
public function toArray()
|
||||||
|
{
|
||||||
|
return $this->_headers;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether there is a header with the specified name.
|
* Returns whether there is a header with the specified name.
|
||||||
* This method is required by the SPL interface `ArrayAccess`.
|
* This method is required by the SPL interface `ArrayAccess`.
|
||||||
|
Reference in New Issue
Block a user