Beispiel #1
0
 /**
  * The iterator's class constructor.
  * @access public
  * @param BinaryNode $subjectNode The node to browse.
  * @param int $method The browsing method.
  */
 public function __construct(AbstractNode $subjectNode, $method = self::PRE_ORDER)
 {
     if ($subjectNode instanceof BinaryNode) {
         $this->_method = $method;
         parent::__construct($subjectNode);
     } else {
         throw new \RuntimeException("BinaryIterator needs an instance of BinaryNode or of its subclasses as subject.");
     }
 }
Beispiel #2
0
 /**
  * Get an iterator for the current node.
  * @return NodeIterator 
  */
 public function iterator()
 {
     $result = new NodeIterator($this);
     return $result->items();
 }