src/Verification/GeneratorVerifier.php
public function checkReceived($value = null): ?EventCollection
    {
        $cardinality = $this->resetCardinality();
        $argumentCount = func_num_args();

        if (0 === $argumentCount) {
            $checkValue = false;
        } else {
            $checkValue = true;
            $value = $this->matcherFactory->adapt($value);
        }

        $isCall = $this->subject instanceof Call;
        $matchingEvents = [];
        $matchCount = 0;
        $eventCount = 0;

        foreach ($this->calls as $call) {
            $isMatchingCall = false;

            foreach ($call->iterableEvents() as $event) {
                if ($event instanceof ReceivedEvent) {
                    ++$eventCount;

                    if (!$checkValue || $value->matches($event->value())) {
                        $matchingEvents[] = $event;
                        $isMatchingCall = true;

                        if ($isCall) {
                            ++$matchCount;
                        }
                    }
                }
            }

            if (!$isCall && $isMatchingCall) {
                ++$matchCount;
            }
        }

        if ($isCall) {
            $totalCount = $eventCount;
        } else {
            $totalCount = $this->callCount;
        }

        if ($cardinality->matches($matchCount, $totalCount)) {
            return $this->assertionRecorder->createSuccess($matchingEvents);
        }

        return null;
    }
public function checkReceived($value = null): ?EventCollection
    {
        $cardinality = $this->resetCardinality();
        $argumentCount = func_num_args();

        if (0 === $argumentCount) {
            $checkValue = false;
        } else {
            $checkValue = true;
            $value = $this->matcherFactory->adapt($value);
        }

        $isCall = $this->subject instanceof Call;
        $matchingEvents = [];
        $matchCount = 0;
        $eventCount = 0;

        foreach ($this->calls as $call) {
            $isMatchingCall = false;

            foreach ($call->iterableEvents() as $event) {
                if ($event instanceof ReceivedEvent) {
                    ++$eventCount;

                    if (!$checkValue || $value->matches($event->value())) {
                        $matchingEvents[] = $event;
                        $isMatchingCall = true;

                        if ($isCall) {
                            ++$matchCount;
                        }
                    }
                }
            }

            if (!$isCall && $isMatchingCall) {
                ++$matchCount;
            }
        }

        if ($isCall) {
            $totalCount = $eventCount;
        } else {
            $totalCount = $this->callCount;
        }

        if ($cardinality->matches($matchCount, $totalCount)) {
            return $this->assertionRecorder->createSuccess($matchingEvents);
        }

        return null;
    }
public function checkReceived ( $ value = null ) : ? EventCollection { $ cardinality = $ this -> resetCardinality ( ) ; $ argumentCount = func_num_args ( ) ; if ( 0 === $ argumentCount ) { $ checkValue = false ; } else { $ checkValue = true ; $ value = $ this -> matcherFactory -> adapt ( $ value ) ; } $ isCall = $ this -> subject instanceof Call ; $ matchingEvents = [ ] ; $ matchCount = 0 ; $ eventCount = 0 ; foreach ( $ this -> calls as $ call ) { $ isMatchingCall = false ; foreach ( $ call -> iterableEvents ( ) as $ event ) { if ( $ event instanceof ReceivedEvent ) { ++ $ eventCount ; if ( ! $ checkValue || $ value -> matches ( $ event -> value ( ) ) ) { $ matchingEvents [ ] = $ event ; $ isMatchingCall = true ; if ( $ isCall ) { ++ $ matchCount ; } } } } if ( ! $ isCall && $ isMatchingCall ) { ++ $ matchCount ; } } if ( $ isCall ) { $ totalCount = $ eventCount ; } else { $ totalCount = $ this -> callCount ; } if ( $ cardinality -> matches ( $ matchCount , $ totalCount ) ) { return $ this -> assertionRecorder -> createSuccess ( $ matchingEvents ) ; } return null ; }
Checks if the subject received the supplied value.

When called with no arguments, this method simply checks that the subject
received any value.

@param mixed $value The value.

@return EventCollection|null The result.
Checks if the subject received the supplied value .