/** * This method initializes the class with the specified values (if any are provided). * * @access public * @param \Traversable $values a traversable array or collection * @throws Throwable\InvalidArgument\Exception indicates that the specified argument * is invalid */ public function __construct($values = null) { $this->file = new IO\TempBuffer('mio-'); $this->writer = new \SplFileObject($this->file->__toString(), 'a'); $this->reader = new \SplFileObject($this->file->__toString(), 'r'); $this->length = 0; if ($values !== null) { if (!(is_array($values) || $values instanceof \Traversable)) { throw new Throwable\InvalidArgument\Exception('Invalid argument specified. Argument must be traversable or null.'); } foreach ($values as $value) { $this->addValue($value); } } $this->pointer = 0; }