|
SPL-StandardPHPLibrary
|


Public Member Functions | |
| __construct (RecursiveIterator $lhs, RecursiveIterator $rhs, $flags=0x33) | |
| areEqual () | |
| areIdentical () | |
| current () | |
| getChildren () | |
| getFlags () | |
| getLHS () | |
| getRHS () | |
| hasChildren () | |
| key () | |
| next () | |
| rewind () | |
| setFlags ($flags) | |
| valid () | |
Static Public Member Functions | |
| static | compareIterators (Iterator $lhs, Iterator $rhs, $identical=false) |
Public Attributes | |
| const | CURRENT_0 = 0x00 |
| const | CURRENT_ARRAY = 0x03 |
| const | CURRENT_LHS = 0x01 |
| const | CURRENT_RHS = 0x02 |
| const | DEFAULT_FLAGS = 0x13 |
| const | KEY_0 = 0x00 |
| const | KEY_LHS = 0x10 |
| const | KEY_RHS = 0x20 |
Private Attributes | |
| $ref | |
Synchronous iteration over two recursive iterators.
Definition at line 17 of file recursivedualiterator.inc.
| RecursiveDualIterator::__construct | ( | RecursiveIterator $ | lhs, |
| RecursiveIterator $ | rhs, | ||
| $ | flags = 0x33 |
||
| ) |
construct iterator from two RecursiveIterator instances
Definition at line 27 of file recursivedualiterator.inc.
References DualIterator\$flags.
{
parent::__construct($lhs, $rhs, $flags);
}
| RecursiveDualIterator::areEqual | ( | ) |
Reimplemented from DualIterator.
Definition at line 65 of file recursivedualiterator.inc.
References DualIterator\getLHS(), and DualIterator\getRHS().
{
return $this->getLHS()->hasChildren() === $this->getRHS()->hasChildren()
&& parent::areEqual();
}

| RecursiveDualIterator::areIdentical | ( | ) |
Reimplemented from DualIterator.
Definition at line 56 of file recursivedualiterator.inc.
References DualIterator\getLHS(), and DualIterator\getRHS().
{
return $this->getLHS()->hasChildren() === $this->getRHS()->hasChildren()
&& parent::areIdentical();
}

| static DualIterator::compareIterators | ( | Iterator $ | lhs, |
| Iterator $ | rhs, | ||
| $ | identical = false |
||
| ) | [static, inherited] |
Compare two iterators.
| lhs | Left Hand Side Iterator |
| rhs | Right Hand Side Iterator |
| identical | whether to use areEqual() or areIdentical() |
Definition at line 165 of file dualiterator.inc.
References $it.
{
if ($lhs instanceof RecursiveIterator)
{
if ($rhs instanceof RecursiveIterator)
{
$it = new RecursiveDualIterator($lhs, $rhs,
self::CURRENT_0 | self::KEY_0);
$it = new RecursiveCompareDualIterator($it);
}
else
{
return false;
}
}
else
{
$it = new DualIterator($lhs, $rhs, self::CURRENT_0 | self::KEY_0);
}
if ($identical)
{
foreach($it as $n)
{
if (!$it->areIdentical())
{
return false;
}
}
}
else
{
foreach($it as $n)
{
if (!$it->areEqual())
{
return false;
}
}
}
return $identical ? $it->areIdentical() : $it->areEqual();
}
| DualIterator::current | ( | ) | [inherited] |
Implements Iterator.
Definition at line 93 of file dualiterator.inc.
{
switch($this->flags & 0x0F)
{
default:
case self::CURRENT_ARRAY:
return array($this->lhs->current(), $this->rhs->current());
case self::CURRENT_LHS:
return $this->lhs->current();
case self::CURRENT_RHS:
return $this->rhs->current();
case self::CURRENT_0:
return NULL;
}
}
| RecursiveDualIterator::getChildren | ( | ) |
Implements RecursiveIterator.
Definition at line 43 of file recursivedualiterator.inc.
References DualIterator\getFlags(), DualIterator\getLHS(), and DualIterator\getRHS().
{
if (empty($this->ref))
{
$this->ref = new ReflectionClass($this);
}
return $this->ref->newInstance(
$this->getLHS()->getChildren(), $this->getRHS()->getChildren(), $this->getFlags());
}

| DualIterator::getFlags | ( | ) | [inherited] |
Definition at line 71 of file dualiterator.inc.
Referenced by getChildren().
{
return $this->flags;
}
| DualIterator::getLHS | ( | ) | [inherited] |
Definition at line 50 of file dualiterator.inc.
Referenced by areEqual(), areIdentical(), getChildren(), and hasChildren().
{
return $this->lhs;
}
| DualIterator::getRHS | ( | ) | [inherited] |
Definition at line 57 of file dualiterator.inc.
Referenced by areEqual(), areIdentical(), getChildren(), and hasChildren().
{
return $this->rhs;
}
| RecursiveDualIterator::hasChildren | ( | ) |
Implements RecursiveIterator.
Definition at line 35 of file recursivedualiterator.inc.
References DualIterator\getLHS(), and DualIterator\getRHS().

| DualIterator::key | ( | ) | [inherited] |
Implements Iterator.
Definition at line 111 of file dualiterator.inc.
{
switch($this->flags & 0xF0)
{
default:
case self::KEY_LHS:
return $this->lhs->key();
case self::KEY_RHS:
return $this->rhs->key();
case self::KEY_0:
return NULL;
}
}
| DualIterator::next | ( | ) | [inherited] |
move both inner iterators forward
Implements Iterator.
Definition at line 127 of file dualiterator.inc.
{
$this->lhs->next();
$this->rhs->next();
}
| DualIterator::rewind | ( | ) | [inherited] |
rewind both inner iterators
Implements Iterator.
Definition at line 78 of file dualiterator.inc.
{
$this->lhs->rewind();
$this->rhs->rewind();
}
| DualIterator::setFlags | ( | $ | flags | ) | [inherited] |
| flags | new flags |
Definition at line 64 of file dualiterator.inc.
References DualIterator\$flags.
{
$this->flags = $flags;
}
| DualIterator::valid | ( | ) | [inherited] |
Implements Iterator.
Definition at line 86 of file dualiterator.inc.
Referenced by DualIterator\areEqual(), and DualIterator\areIdentical().
{
return $this->lhs->valid() && $this->rhs->valid();
}
RecursiveDualIterator::$ref [private] |
Definition at line 19 of file recursivedualiterator.inc.
const DualIterator::CURRENT_0 = 0x00 [inherited] |
Definition at line 22 of file dualiterator.inc.
const DualIterator::CURRENT_ARRAY = 0x03 [inherited] |
Definition at line 21 of file dualiterator.inc.
const DualIterator::CURRENT_LHS = 0x01 [inherited] |
Definition at line 19 of file dualiterator.inc.
const DualIterator::CURRENT_RHS = 0x02 [inherited] |
Definition at line 20 of file dualiterator.inc.
const DualIterator::DEFAULT_FLAGS = 0x13 [inherited] |
Definition at line 28 of file dualiterator.inc.
const DualIterator::KEY_0 = 0x00 [inherited] |
Definition at line 26 of file dualiterator.inc.
const DualIterator::KEY_LHS = 0x10 [inherited] |
Definition at line 24 of file dualiterator.inc.
const DualIterator::KEY_RHS = 0x20 [inherited] |
Definition at line 25 of file dualiterator.inc.
1.7.5.1