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