Eloquent\Phony\Spy\SpyVerifier::checkIterated PHP Метод

checkIterated() публичный Метод

Checks if this spy returned an iterable.
public checkIterated ( ) : IterableVerifier | null
Результат Eloquent\Phony\Verification\IterableVerifier | null The result.
    public function checkIterated()
    {
        $cardinality = $this->resetCardinality();
        $calls = $this->spy->allCalls();
        $matchingEvents = array();
        $totalCount = count($calls);
        $matchCount = 0;
        foreach ($calls as $call) {
            if (!$call->responseEvent()) {
                continue;
            }
            list(, $returnValue) = $call->response();
            if ($returnValue instanceof Traversable || is_array($returnValue)) {
                $matchingEvents[] = $call;
                ++$matchCount;
            }
        }
        if ($cardinality->matches($matchCount, $totalCount)) {
            return $this->assertionRecorder->createSuccessFromEventCollection($this->iterableVerifierFactory->create($this->spy, $matchingEvents));
        }
    }