Total Complexity | 7 |
Total Lines | 16 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
8 | class IsIterable implements Validator { |
||
9 | private $description; |
||
10 | |||
11 | 5 | public function __construct($description = null) { |
|
12 | 5 | if (!is_null($description)) |
|
13 | 1 | $this->description = $description; |
|
14 | 5 | } |
|
15 | |||
16 | 4 | public function validate($value): bool { |
|
17 | 4 | if (is_array($value)) return true; |
|
18 | 3 | if (is_object($value) && $value instanceof \Traversable) return true; |
|
19 | 1 | return false; |
|
20 | } |
||
21 | |||
22 | 1 | public function getDescription() { |
|
24 | } |
||
25 | } |