1 | <?php |
||
12 | abstract class AbstractMatcher implements MatcherInterface |
||
13 | { |
||
14 | /** |
||
15 | * @var mixed |
||
16 | */ |
||
17 | protected $expected; |
||
18 | |||
19 | /** |
||
20 | * @var bool |
||
21 | */ |
||
22 | protected $negated = false; |
||
23 | |||
24 | /** |
||
25 | * @var TemplateInterface |
||
26 | */ |
||
27 | protected $template; |
||
28 | |||
29 | /** |
||
30 | * @var Assertion |
||
31 | */ |
||
32 | protected $assertion; |
||
33 | |||
34 | /** |
||
35 | * @param mixed $expected |
||
36 | */ |
||
37 | public function __construct($expected) |
||
41 | |||
42 | /** |
||
43 | * {@inheritdoc} |
||
44 | * |
||
45 | * @return bool |
||
46 | */ |
||
47 | public function isNegated() |
||
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | * |
||
55 | * @return $this |
||
56 | */ |
||
57 | public function invert() |
||
62 | |||
63 | /** |
||
64 | * {@inheritdoc} |
||
65 | * |
||
66 | * @param mixed $actual |
||
67 | * @return Match |
||
68 | */ |
||
69 | public function match($actual = "") |
||
77 | |||
78 | /** |
||
79 | * {@inheritdoc} |
||
80 | * |
||
81 | * @return TemplateInterface |
||
82 | */ |
||
83 | public function getTemplate() |
||
90 | |||
91 | /** |
||
92 | * {@inheritdoc} |
||
93 | * |
||
94 | * @param TemplateInterface $template |
||
95 | * @return $this |
||
96 | */ |
||
97 | public function setTemplate(TemplateInterface $template) |
||
102 | |||
103 | /** |
||
104 | * {@inheritdoc} |
||
105 | * |
||
106 | * @param Assertion $assertion |
||
107 | * @return $this |
||
108 | */ |
||
109 | public function setAssertion(Assertion $assertion) |
||
114 | |||
115 | /** |
||
116 | * The actual matching algorithm for the matcher. This is called by ->match() |
||
117 | * to create a Match result. |
||
118 | * |
||
119 | * @param mixed $actual |
||
120 | * @return bool |
||
121 | */ |
||
122 | abstract protected function doMatch($actual); |
||
123 | } |
||
124 |