Eloquent\Phony\Spy\SpyVerifier::checkCalledWith PHP Method

checkCalledWith() public method

Checks if called with the supplied arguments.
public checkCalledWith ( ) : Eloquent\Phony\Event\EventCollection | null
return Eloquent\Phony\Event\EventCollection | null The result.
    public function checkCalledWith()
    {
        $cardinality = $this->resetCardinality();
        $matchers = $this->matcherFactory->adaptAll(func_get_args());
        $calls = $this->spy->allCalls();
        $matchingEvents = array();
        $totalCount = count($calls);
        $matchCount = 0;
        foreach ($calls as $call) {
            if ($this->matcherVerifier->matches($matchers, $call->arguments()->all())) {
                $matchingEvents[] = $call;
                ++$matchCount;
            }
        }
        if ($cardinality->matches($matchCount, $totalCount)) {
            return $this->assertionRecorder->createSuccess($matchingEvents);
        }
    }