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