PHPSpec2\Matcher\MatchersCollection::add PHP Method

add() public method

public add ( PHPSpec2\Matcher\MatcherInterface $matcher )
$matcher PHPSpec2\Matcher\MatcherInterface
    public function add(MatcherInterface $matcher)
    {
        $this->matchers[] = $matcher;
        $this->sorted = false;
    }

Usage Example

Example #1
0
 protected function createMatchersCollection(Presenter\PresenterInterface $presenter, ArgumentsUnwrapper $unwrapper)
 {
     $matchers = new Matcher\MatchersCollection();
     $matchers->add(new Matcher\IdentityMatcher($presenter));
     $matchers->add(new Matcher\ComparisonMatcher($presenter));
     $matchers->add(new Matcher\ThrowMatcher($unwrapper, $presenter));
     $matchers->add(new Matcher\CountMatcher($presenter));
     $matchers->add(new Matcher\TypeMatcher($presenter));
     $matchers->add(new Matcher\ObjectStateMatcher($presenter));
     return $matchers;
 }
MatchersCollection