Conditions | 4 |
Paths | 2 |
Total Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
43 | 5 | public function __invoke($value) |
|
44 | { |
||
45 | 5 | if (!is_array($value) && !$value instanceof ArrayAccess) { |
|
46 | 2 | throw new InvalidArgumentException(sprintf( |
|
47 | 2 | 'Argument 1 passed to %s must be an array, %s given', |
|
48 | 2 | __METHOD__, |
|
49 | 2 | is_object($value) ? get_class($value) : gettype($value) |
|
50 | )); |
||
51 | } |
||
52 | |||
53 | 3 | return $value[$this->key] ?? null; |
|
54 | } |
||
55 | } |
||
56 |