1: <?php
2: namespace Peridot\Leo\Matcher;
3:
4: use Peridot\Leo\Assertion;
5: use Peridot\Leo\Matcher\Template\TemplateInterface;
6:
7: /**
8: * MatcherInterface defines how an expected value is matched
9: * against certain criteria. A matcher is also responsible for returning the TemplateInterface
10: * used for formatting match results.
11: *
12: * @package Peridot\Leo\Matcher
13: */
14: interface MatcherInterface
15: {
16: /**
17: * Returns whether or not the matcher is negated. A negated matcher negates
18: * the results of a match.
19: *
20: * @return bool
21: */
22: public function isNegated();
23:
24: /**
25: * Inverts a matcher. If a matcher is not negated, it will become negated. If a matcher
26: * is negated, it will no longer be negated.
27: *
28: * @return $this
29: */
30: public function invert();
31:
32: /**
33: * Perform a match against an actual value.
34: *
35: * @param mixed $actual
36: * @return Match
37: */
38: public function match($actual);
39:
40: /**
41: * Return the TemplateInterface being used by the matcher.
42: *
43: * @return TemplateInterface
44: */
45: public function getTemplate();
46:
47: /**
48: * Set the Assertion bound to the matcher. Useful for checking
49: * flags from within a matcher.
50: *
51: * @param Assertion $assertion
52: * @return mixed
53: */
54: public function setAssertion(Assertion $assertion);
55:
56: /**
57: * Set the TemplateInterface to use for formatting match results.
58: *
59: * @param TemplateInterface $template
60: * @return $this
61: */
62: public function setTemplate(TemplateInterface $template);
63:
64: /**
65: * Return a default TemplateInterface if none was set.
66: *
67: * @return TemplateInterface
68: */
69: public function getDefaultTemplate();
70: }
71: