Total Complexity | 4 |
Total Lines | 29 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | final class ArrayResult implements Result |
||
10 | { |
||
11 | use ResultPaginator; |
||
12 | |||
13 | private array $data; |
||
14 | |||
15 | 33 | public function __construct(array $data) |
|
16 | { |
||
17 | 33 | $this->data = $data; |
|
18 | 33 | } |
|
19 | |||
20 | 22 | public function take(int $offset, int $limit): Page |
|
21 | { |
||
22 | 22 | return new ArrayPage( |
|
23 | 22 | \array_slice($this->data, $offset, $limit), |
|
24 | $offset, |
||
25 | $limit, |
||
26 | 22 | \count($this->data) |
|
27 | ); |
||
28 | } |
||
29 | |||
30 | 17 | public function count(): int |
|
33 | } |
||
34 | |||
35 | 11 | public function getIterator(): \Traversable |
|
40 |