setPrefixPart(RecursiveTreeIterator::PREFIX_END_HAS_NEXT, self::HAS_NEXT); $this->setPrefixPart(RecursiveTreeIterator::PREFIX_END_LAST, self::LAST); $this->rewind(); $this->reflections = $reflections; } /** * Returns if the current item has a sibling on the same level. * * @return boolean */ public function hasSibling() { $prefix = $this->getPrefix(); return !empty($prefix) && self::HAS_NEXT === substr($prefix, -1); } /** * Returns the current reflection. * * @return \ApiGen\Reflection * @throws \UnexpectedValueException If current is not reflection array. */ public function current() { $className = $this->key(); if (!isset($this->reflections[$className])) { throw new RuntimeException(sprintf('Class "%s" is not in the reflection array', $className)); } return $this->reflections[$className]; } }