/** * Returns the previous section. * * @return Sensei_Doc_Section */ public function previous($maxLevel = 0) { if ($maxLevel > 0 && $this->_level > $maxLevel) { $previous = $this; while ($previous->_level > $maxLevel) { $previous = $previous->getParent(); } return $previous; } if ($this->_index === 0) { return $this->getParent(); } else { $previousSibling = $this->_parent->getChild($this->_index - 1); return $previousSibling->findLastChild($maxLevel); } }
/** * Returns a root section with the given index. * * @param int $index * @return Sensei_Doc_Section */ public function getChild($index) { return $this->_toc->getChild($index); }