Conditions | 5 |
Paths | 4 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
19 | 31 | public function slice($start, $end = null) |
|
20 | { |
||
21 | 31 | if (!is_int($start)) { |
|
22 | 3 | throw new \InvalidArgumentException('Argument $start must be an integer'); |
|
23 | } |
||
24 | |||
25 | 28 | if (!(is_null($end) || is_int($end))) { |
|
26 | 2 | throw new \InvalidArgumentException('Argument $end must be an integer or null'); |
|
27 | } |
||
28 | |||
29 | 26 | if ($this instanceof \Iterator) { |
|
30 | 25 | return new SliceIterator($this, $start, $end); |
|
31 | } |
||
32 | |||
33 | 1 | return null; |
|
34 | } |
||
35 | } |
||
36 |