/** * * @param ExampleNode $example * @param SpecificationInterface $context * @param MatcherManager $matchers * @param CollaboratorManager $collaborators */ public function prepare(ExampleNode $example, SpecificationInterface $context, MatcherManager $matchers, CollaboratorManager $collaborators) { $matchers->replace($this->defaultMatchers); if (!$context instanceof Matcher\MatchersProviderInterface) { return; } foreach ($context->getMatchers() as $name => $matcher) { if ($matcher instanceof Matcher\MatcherInterface) { $matchers->add($matcher); } else { $matchers->add(new Matcher\CallbackMatcher($name, $matcher, $this->presenter)); } } }