/** * Rewinds the collection of sub-`Document`s to the beginning and returns the first one found. * * @return object Returns the first `Document` object instance in the collection. */ public function rewind() { $data = parent::rewind(); $key = key($this->_data); return $this->offsetGet($key); }
/** * Rewinds the collection of sub-`Document`s to the beginning and returns the first one found. * * @return object Returns the first `Document` object instance in the collection. */ public function rewind() { $data = parent::rewind() ?: $this->_populate(); $key = key($this->_data); if (is_object($data)) { return $data; } if (isset($this->_data[$key])) { return $this->offsetGet($key); } }
/** * Reset the set's iterator and return the first record in the set. * The next call of `current()` will get the first record in the set. * * @return object `Record` */ public function rewind() { $this->_pointer = 0; reset($this->_index); if ($record = parent::rewind()) { return $record; } return empty($this->_data) ? null : $this->_data[$this->_pointer]; }
/** * Rewinds the collection of sub-`Document`s to the beginning and returns the first one found. * * @return object Returns the first `Document` object instance in the collection. */ public function rewind() { $data = parent::rewind(); $key = key($this->_data); if (is_a($data, $this->_classes['entity'])) { return $data; } if ($this->_isComplexType($data)) { $this->_data[$key] = $this->_relation('entity', $key, $this->_data[$key]); } return isset($this->_data[$key]) ? $this->_data[$key] : null; }