Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3.0987 |
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 | 1 | $supportedCasts = [self::CAST_BOOL, self::CAST_FLOAT, self::CAST_INT]; |
|
37 | 1 | 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 | 1 | $this->cast = $cast; |
|
43 | } |
||
44 | 1 | } |
|
45 | |||
75 |