Commit ad19e332 by Qiang Xue

Added back some toArray() implementations.

parent b3b515b9
......@@ -145,6 +145,9 @@ class ErrorHandler extends Component
'message' => $exception->getMessage(),
'code' => $exception->getCode(),
];
if ($exception instanceof HttpException) {
$array['status'] = $exception->statusCode;
}
if (($prev = $exception->getPrevious()) !== null) {
$array['previous'] = $this->convertExceptionToArray($prev);
}
......
......@@ -166,6 +166,16 @@ class CookieCollection extends Object implements \IteratorAggregate, \ArrayAcces
}
/**
* 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.
* This method is required by the SPL interface `ArrayAccess`.
* It is implicitly called when you use something like `isset($collection[$name])`.
......
......@@ -160,6 +160,16 @@ class HeaderCollection extends Object implements \IteratorAggregate, \ArrayAcces
}
/**
* 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.
* This method is required by the SPL interface `ArrayAccess`.
* It is implicitly called when you use something like `isset($collection[$name])`.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment