Passed
Push — master ( c5f7d7...9e35d8 )
by Smoren
02:08
created

xrange()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 3
dl 0
loc 7
ccs 3
cts 3
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Smoren\Sequence\Functions;
4
5
use Smoren\Sequence\Structs\IntRange;
6
7
/**
8
 * @param int $start
9
 * @param int|null $size
10
 * @param int $step
11
 * @return IntRange
12
 */
13
function xrange(int $start, ?int $size = null, int $step = 1): IntRange
14
{
15 1
    if($size === null) {
16 1
        [$start, $size] = [0, $start];
17
    }
18
19 1
    return new IntRange($start, $size, $step);
20
}
21