for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
Install GitHub App
<?php
/*
* This file is part of Respect/Validation.
*
* (c) Alexandre Gomes Gaigalas <[email protected]>
* For the full copyright and license information, please view the "LICENSE.md"
* file that was distributed with this source code.
*/
namespace Respect\Validation;
use Countable;
use Exception;
use RecursiveIterator;
final class ResultIterator implements RecursiveIterator, Countable
{
/**
* @var Result[]
private $children;
public function __construct(Result $result)
$this->children = $result->getChildren();
}
public function current(): ?Result
$current = current($this->children);
if (false === $current) {
return null;
return $current;
public function next(): ?Result
$next = next($this->children);
if (false == $next) {
return $next;
public function key()
$current = $this->current();
if (null === $current) {
return $current->getProperties()['reference'] ?? key($this->children);
public function valid(): bool
return null !== $this->current();
public function rewind(): void
reset($this->children);
public function hasChildren(): bool
$children = $this->current()->getChildren();
return count($children) > 0;
public function getChildren(): ResultIterator
throw new Exception();
return new self($current);
public function count(): int
return count($this->children);