mirror of
https://github.com/Respect/Validation.git
synced 2026-03-16 07:15:45 +01:00
Most changes was made by php-cs-fixer. Also removes unused `RecursiveTreeIterator` class.
30 lines
797 B
PHP
30 lines
797 B
PHP
<?php
|
|
namespace Respect\Validation;
|
|
|
|
use RecursiveArrayIterator;
|
|
use Respect\Validation\Exceptions\AbstractNestedException;
|
|
|
|
class ExceptionIterator extends RecursiveArrayIterator
|
|
{
|
|
protected $fullRelated;
|
|
|
|
public function __construct($target, $fullRelated = false)
|
|
{
|
|
$this->fullRelated = $fullRelated;
|
|
parent::__construct(is_array($target) ? $target : array($target));
|
|
}
|
|
|
|
public function hasChildren()
|
|
{
|
|
if (!$this->current() instanceof AbstractNestedException) {
|
|
return false;
|
|
} else {
|
|
return (boolean) $this->current()->getRelated($this->fullRelated);
|
|
}
|
|
}
|
|
|
|
public function getChildren()
|
|
{
|
|
return new static($this->current()->getRelated($this->fullRelated), $this->fullRelated);
|
|
}
|
|
}
|