Total Complexity | 3 |
Total Lines | 20 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
11 | final class IsIterable extends ComposingAssertion implements Validation |
||
12 | { |
||
13 | public const NOT_AN_ITERABLE = 'is-iterable.not-an-iterable'; |
||
14 | |||
15 | public function __construct(?callable $errorFormatter = null) |
||
16 | { |
||
17 | $this->isAsAsserted = IsAsAsserted::withAssertionAndErrorFormatter( |
||
18 | 'is_iterable', |
||
19 | is_callable($errorFormatter) ? |
||
|
|||
20 | $errorFormatter : |
||
21 | function ($data) { |
||
22 | return [self::NOT_AN_ITERABLE]; |
||
23 | } |
||
24 | ); |
||
25 | } |
||
26 | |||
27 | public static function withTranslator(Translator $translator): self |
||
31 | }); |
||
32 | } |
||
34 |