1 | <?php |
||
13 | abstract class CountableMatcher extends AbstractMatcher |
||
14 | { |
||
15 | /** |
||
16 | * @var mixed |
||
17 | */ |
||
18 | protected $countable; |
||
19 | |||
20 | /** |
||
21 | * Set the countable value used by the CountableMatcher. |
||
22 | * |
||
23 | * @param mixed $countable |
||
24 | * @return $this |
||
25 | */ |
||
26 | public function setCountable($countable) |
||
31 | |||
32 | /** |
||
33 | * Return the countable used by the CountableMatcher. |
||
34 | * |
||
35 | * @return mixed |
||
36 | */ |
||
37 | public function getCountable() |
||
41 | |||
42 | /** |
||
43 | * Get the count of the countable value. |
||
44 | * @return int |
||
45 | */ |
||
46 | public function getCount() |
||
54 | |||
55 | /** |
||
56 | * {@inheritdoc} |
||
57 | * |
||
58 | * Returns a default countable interface if the countable is set. |
||
59 | * |
||
60 | * @return TemplateInterface |
||
61 | */ |
||
62 | public function getTemplate() |
||
70 | |||
71 | /** |
||
72 | * {@inheritdoc} |
||
73 | * |
||
74 | * @param $actual |
||
75 | * @return mixed |
||
76 | */ |
||
77 | protected function doMatch($actual = null) |
||
89 | |||
90 | /** |
||
91 | * Return a default template for when a countable has been set. |
||
92 | * |
||
93 | * @return TemplateInterface |
||
94 | */ |
||
95 | abstract public function getDefaultCountableTemplate(); |
||
96 | |||
97 | /** |
||
98 | * Determine if a number matches a specified condition |
||
99 | * |
||
100 | * @param $number |
||
101 | * @return bool |
||
102 | */ |
||
103 | abstract protected function matchNumeric($number); |
||
104 | } |
||
105 |