original_string: public function exchangeArray($collection)
      {
          if (!is_array($collection) && !($collection instanceof Traversable)) {
              throw new Exception\InvalidArgumentException(
                  sprintf(
                      'Expected argument "array" or "Traversable"; "%s" given',
                      gettype($collection) . (is_object($collection) ? '(' . get_class($collection) . ')' : '')
                  )
              );
          }
  
          if ($collection instanceof Traversable) {
              $collection = ArrayUtils::iteratorToArray($collection);
          }
  
          foreach ($collection as $key => $value) {
              $this->set($key, $value);
          }
      }
code: public function exchangeArray($collection)
      {
          if (!is_array($collection) && !($collection instanceof Traversable)) {
              throw new Exception\InvalidArgumentException(
                  sprintf(
                      'Expected argument "array" or "Traversable"; "%s" given',
                      gettype($collection) . (is_object($collection) ? '(' . get_class($collection) . ')' : '')
                  )
              );
          }
  
          if ($collection instanceof Traversable) {
              $collection = ArrayUtils::iteratorToArray($collection);
          }
  
          foreach ($collection as $key => $value) {
              $this->set($key, $value);
          }
      }
code_tokens: public function exchangeArray ( $ collection ) { if ( ! is_array ( $ collection ) && ! ( $ collection instanceof Traversable ) ) { throw new Exception \ InvalidArgumentException ( sprintf ( 'Expected argument "array" or "Traversable"; "%s" given' , gettype ( $ collection ) . ( is_object ( $ collection ) ? '(' . get_class ( $ collection ) . ')' : '' ) ) ) ; } if ( $ collection instanceof Traversable ) { $ collection = ArrayUtils :: iteratorToArray ( $ collection ) ; } foreach ( $ collection as $ key => $ value ) { $ this -> set ( $ key , $ value ) ; } }
docstring: Sets a whole new array replacement.
  
  @param array|Traversable $collection
  
  @return void
  @throws \Xloit\Collection\Exception\InvalidArgumentException
  @throws \Zend\Stdlib\Exception\InvalidArgumentException
docstring_tokens: Sets a whole new array replacement .