Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 4.5435 |
Changes | 0 |
1 | <?php |
||
31 | 1 | public function __construct(AccessorInterface $accessor, string $cast = null) |
|
32 | { |
||
33 | 1 | $this->accessor = $accessor; |
|
34 | |||
35 | 1 | if (null !== $cast) { |
|
36 | $supportedCasts = [self::CAST_BOOL, self::CAST_FLOAT, self::CAST_INT]; |
||
37 | if (!in_array($cast, $supportedCasts, true)) { |
||
38 | throw new \InvalidArgumentException( |
||
39 | sprintf('Cast %s is not support, supported casts: %s', $cast, implode(', ', $supportedCasts)) |
||
40 | ); |
||
41 | } |
||
42 | $this->cast = $cast; |
||
43 | } |
||
44 | 1 | } |
|
45 | |||
75 |