/**
  * Returns true if this list iterator has more elements when traversing the list in the backward direction.
  * @return boolean
  */
 public function next()
 {
     if ($this->hasNext()) {
         $this->canRemove = true;
         return $this->list->get(--$this->index);
     } else {
         throw new NoSuchElementException("Could not find element at index {$this->index}");
     }
 }
Пример #2
0
 /**
  * Injects a node into the current tree structure,
  * such that the node at the specified index becomes
  * a child of the injected node, and the injected node
  * moves to the specified index in the receiver
  * @param int $index
  * @param TreeNodeInterface $node
  */
 public function injectAt($index, TreeNodeInterface $node)
 {
     $node->insert($this->children->get($index));
     $this->replaceAt($index, $node);
 }