Conditions | 4 |
Paths | 6 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
43 | 23 | public static function numbers(int $from, ?int $to = null): Collection |
|
44 | { |
||
45 | 23 | if ($to === null) { |
|
46 | 22 | $to = $from - 1; |
|
47 | 22 | $from = 0; |
|
48 | } |
||
49 | |||
50 | 23 | if ($from > $to) { |
|
51 | 1 | throw new RuntimeException('FROM need to be less than TO'); |
|
52 | } |
||
53 | 23 | $list = new ArrayList(); |
|
54 | 23 | for ($i = $from; $i <= $to; $i++) { |
|
55 | 23 | $list->add($i); |
|
56 | } |
||
57 | |||
58 | 23 | return $list; |
|
59 | } |
||
86 |