| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 2.0078 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 24 | 10 | public function initialize(ReadCommandInterface $query, int $chunkSize, int $startPage): WalkCursor |
|
| 25 | { |
||
| 26 | 10 | if (!$query instanceof Limitable) { |
|
| 27 | throw new InvalidArgumentException('The query must be an instance of '.Limitable::class); |
||
| 28 | } |
||
| 29 | |||
| 30 | 10 | $query = clone $query; |
|
| 31 | 10 | $cursor = new WalkCursor($query); |
|
| 32 | |||
| 33 | 10 | $cursor->cursor = ($startPage - 1) * $chunkSize; |
|
| 34 | 10 | $query->limit($chunkSize); |
|
| 35 | |||
| 36 | 10 | return $cursor; |
|
| 37 | } |
||
| 60 |