Total Complexity | 4 |
Total Lines | 29 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
7 | class PaginationResolver |
||
8 | { |
||
9 | |||
10 | /** |
||
11 | * @param array $args |
||
12 | * |
||
13 | * @return int |
||
14 | */ |
||
15 | public static function resolveFrom(array $args) |
||
16 | { |
||
17 | if (isset($args['after'])) { |
||
18 | $index = (int)NodeIdResolver::idFromGlobalId($args['after']); |
||
19 | |||
20 | // Logic: 19 (index) + 1 (next) = 20 (from) |
||
21 | return $index + 1; |
||
22 | } |
||
23 | |||
24 | // Otherwise from is 0 |
||
25 | return 0; |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * @param array $args |
||
30 | * |
||
31 | * @return int |
||
32 | */ |
||
33 | public static function resolveSize(array $args): int |
||
36 | } |
||
37 | } |
||
38 |