You are here

public function ArrayObject::exchangeArray in Express 8

Exchange the array for another one.

Parameters

array|ArrayObject $data: New data.

Return value

array The old array.

Throws

\InvalidArgumentException When the passed data is not an array or an instance of ArrayObject.

2 calls to ArrayObject::exchangeArray()
ArrayObject::unserialize in themes/contrib/bootstrap/src/Utility/ArrayObject.php
Unserialize an ArrayObject.
Element::exchangeArray in themes/contrib/bootstrap/src/Utility/Element.php
Exchange the array for another one.
1 method overrides ArrayObject::exchangeArray()
Element::exchangeArray in themes/contrib/bootstrap/src/Utility/Element.php
Exchange the array for another one.

File

themes/contrib/bootstrap/src/Utility/ArrayObject.php, line 189
Contains \Drupal\bootstrap\Utility\ArrayObject.

Class

ArrayObject
Custom ArrayObject implementation.

Namespace

Drupal\bootstrap\Utility

Code

public function exchangeArray($data) {
  if (!is_array($data) && is_object($data) && !$data instanceof ArrayObject) {
    throw new \InvalidArgumentException('Passed variable is not an array or an instance of \\Drupal\\bootstrap\\Utility\\ArrayObject.');
  }
  if (is_object($data) && $data instanceof ArrayObject) {
    $data = $data
      ->getArrayCopy();
  }
  $old = $this->array;
  $this->array = $data;
  return $old;
}