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