1 | <?php |
||
20 | class ArrayCountToken implements TokenInterface |
||
21 | { |
||
22 | private $count; |
||
23 | |||
24 | /** |
||
25 | * @param integer $value |
||
26 | */ |
||
27 | public function __construct($value) |
||
31 | |||
32 | /** |
||
33 | * Scores 6 when argument has preset number of elements. |
||
34 | * |
||
35 | * @param $argument |
||
36 | * |
||
37 | * @return bool|int |
||
38 | */ |
||
39 | public function scoreArgument($argument) |
||
43 | |||
44 | /** |
||
45 | * Returns false. |
||
46 | * |
||
47 | * @return boolean |
||
48 | */ |
||
49 | public function isLast() |
||
53 | |||
54 | /** |
||
55 | * Returns string representation for token. |
||
56 | * |
||
57 | * @return string |
||
58 | */ |
||
59 | public function __toString() |
||
63 | |||
64 | /** |
||
65 | * Returns true if object is either array or instance of \Countable |
||
66 | * |
||
67 | * @param $argument |
||
68 | * @return bool |
||
69 | */ |
||
70 | private function isCountable($argument) |
||
74 | |||
75 | /** |
||
76 | * Returns true if $argument has expected number of elements |
||
77 | * |
||
78 | * @param array|\Countable $argument |
||
79 | * |
||
80 | * @return bool |
||
81 | */ |
||
82 | private function hasProperCount($argument) |
||
86 | } |
||
87 |