| Conditions | 5 |
| Paths | 5 |
| Total Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | 50 | public function __invoke($data) |
|
| 20 | { |
||
| 21 | 50 | if ( is_array($data)) { |
|
| 22 | 5 | return new PsrContainer( new PimpleContainer( $data ) ); |
|
| 23 | } |
||
| 24 | 45 | elseif ($data instanceOf PimpleContainer) { |
|
| 25 | 5 | return new PsrContainer( $data ); |
|
| 26 | } |
||
| 27 | 40 | elseif ($data instanceOf ContainerInterface) { |
|
| 28 | 5 | return $data; |
|
| 29 | } |
||
| 30 | 35 | elseif ($data instanceOf \StdClass) { |
|
| 31 | 5 | return new PsrContainer( new PimpleContainer((array) $data) ); |
|
| 32 | } |
||
| 33 | 30 | throw new \InvalidArgumentException( "Expected array, Pimple Container, or PSR ContainerInterface"); |
|
| 34 | } |
||
| 35 | } |
||
| 36 |