Conditions | 4 |
Paths | 4 |
Total Lines | 18 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
30 | 8 | private function convert(&$data): Rewindable |
|
31 | { |
||
32 | 8 | 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 | 4 | if (\is_callable($data)) { |
|
41 | return |
||
42 | 2 | new Rewindable($data); |
|
43 | } |
||
44 | 2 | if ($data instanceof Rewindable) { |
|
45 | 1 | return $data; |
|
46 | } |
||
47 | 1 | throw new \InvalidArgumentException('Unexpected argument type: ' . typeOf($data) . ' for ' . Caller::get()); |
|
48 | } |
||
118 |