Eloquent\Phony\Verification\IterableVerifier::checkConsumed PHP Method

checkConsumed() public method

Checks if the subject was completely consumed.
public checkConsumed ( ) : Eloquent\Phony\Event\EventCollection | null
return Eloquent\Phony\Event\EventCollection | null The result.
    public function checkConsumed()
    {
        $cardinality = $this->resetCardinality();
        if ($this->subject instanceof Call) {
            $cardinality->assertSingular();
        }
        $matchingEvents = array();
        $matchCount = 0;
        foreach ($this->calls as $call) {
            if (!($endEvent = $call->endEvent())) {
                continue;
            }
            if (!$call->isIterable()) {
                continue;
            }
            ++$matchCount;
            $matchingEvents[] = $endEvent;
        }
        if ($cardinality->matches($matchCount, $this->callCount)) {
            return $this->assertionRecorder->createSuccess($matchingEvents);
        }
    }