Eloquent\Phony\Verification\AbstractCardinalityVerifierEventCollection::__construct PHP Метод

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

Construct a new cardinality verifier event collection.
public __construct ( array $events, CallVerifierFactory $callVerifierFactory )
$events array
$callVerifierFactory Eloquent\Phony\Call\CallVerifierFactory The call verifier factory to use.
    public function __construct(array $events, CallVerifierFactory $callVerifierFactory)
    {
        $calls = array();
        foreach ($events as $event) {
            if ($event instanceof Call) {
                $calls[] = $event;
            }
        }
        $this->events = $events;
        $this->calls = $calls;
        $this->eventCount = count($events);
        $this->callCount = count($calls);
        $this->callVerifierFactory = $callVerifierFactory;
        $this->resetCardinality();
    }

Usage Example

Пример #1
0
 /**
  * Construct a new iterable verifier.
  *
  * @param Spy|Call            $subject             The subject.
  * @param array<Call>         $calls               The iterable calls.
  * @param MatcherFactory      $matcherFactory      The matcher factory to use.
  * @param CallVerifierFactory $callVerifierFactory The call verifier factory to use.
  * @param AssertionRecorder   $assertionRecorder   The assertion recorder to use.
  * @param AssertionRenderer   $assertionRenderer   The assertion renderer to use.
  */
 public function __construct($subject, array $calls, MatcherFactory $matcherFactory, CallVerifierFactory $callVerifierFactory, AssertionRecorder $assertionRecorder, AssertionRenderer $assertionRenderer)
 {
     $this->subject = $subject;
     $this->matcherFactory = $matcherFactory;
     $this->assertionRecorder = $assertionRecorder;
     $this->assertionRenderer = $assertionRenderer;
     $this->isGenerator = false;
     parent::__construct($calls, $callVerifierFactory);
 }