| Conditions | 4 |
| Paths | 4 |
| Total Lines | 18 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4.016 |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | 7 | private function convert(&$data): Rewindable |
|
| 31 | { |
||
| 32 | 7 | if (\is_array($data)) { |
|
| 33 | return |
||
| 34 | 4 | new Rewindable( |
|
| 35 | function () use (&$data): \Generator { |
||
| 36 | 4 | yield from $data; |
|
| 37 | 4 | } |
|
| 38 | ); |
||
| 39 | } |
||
| 40 | 3 | if (\is_callable($data)) { |
|
| 41 | return |
||
| 42 | 2 | new Rewindable($data); |
|
| 43 | } |
||
| 44 | 1 | if ($data instanceof Rewindable) { |
|
| 45 | return $data; |
||
| 46 | } |
||
| 47 | 1 | throw new \InvalidArgumentException('Unexpected argument type: ' . typeOf($data) . ' for ' . Caller::get()); |
|
| 48 | } |
||
| 127 |