Back to index

php5  5.3.10
recursivedualiterator.inc
Go to the documentation of this file.
00001 <?php
00002 
00017 class RecursiveDualIterator extends DualIterator implements RecursiveIterator
00018 {
00019        private $ref;
00020 
00027        function __construct(RecursiveIterator $lhs, RecursiveIterator $rhs, 
00028                             $flags = 0x33 /*DualIterator::DEFAULT_FLAGS*/)
00029        {
00030               parent::__construct($lhs, $rhs, $flags);
00031        }
00032 
00035        function hasChildren()
00036        {
00037               return $this->getLHS()->hasChildren() && $this->getRHS()->hasChildren();     
00038        }
00039 
00043        function getChildren()
00044        {
00045               if (empty($this->ref))
00046               {
00047                      $this->ref = new ReflectionClass($this);
00048               }
00049               return $this->ref->newInstance(
00050                                    $this->getLHS()->getChildren(), $this->getRHS()->getChildren(), $this->getFlags());
00051        }
00052 
00056        function areIdentical()
00057        {
00058               return $this->getLHS()->hasChildren() === $this->getRHS()->hasChildren()
00059                      && parent::areIdentical();
00060        }
00061 
00065        function areEqual()
00066        {
00067               return $this->getLHS()->hasChildren() === $this->getRHS()->hasChildren()
00068                      && parent::areEqual();
00069        }
00070 }
00071 
00072 ?>