public function ArrayObject::exchangeArray in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/zendframework/zend-stdlib/src/ArrayObject.php \Zend\Stdlib\ArrayObject::exchangeArray()
Exchange the array for another one.
Parameters
array|ArrayObject $data:
Return value
array
1 call to ArrayObject::exchangeArray()
- ArrayObject::unserialize in vendor/
zendframework/ zend-stdlib/ src/ ArrayObject.php - Unserialize an ArrayObject
File
- vendor/
zendframework/ zend-stdlib/ src/ ArrayObject.php, line 181
Class
- ArrayObject
- Custom framework ArrayObject implementation
Namespace
Zend\StdlibCode
public function exchangeArray($data) {
if (!is_array($data) && !is_object($data)) {
throw new Exception\InvalidArgumentException('Passed variable is not an array or object, using empty array instead');
}
if (is_object($data) && ($data instanceof self || $data instanceof \ArrayObject)) {
$data = $data
->getArrayCopy();
}
if (!is_array($data)) {
$data = (array) $data;
}
$storage = $this->storage;
$this->storage = $data;
return $storage;
}