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