Skip to content

Commit

Permalink
Simplified buildPagination
Browse files Browse the repository at this point in the history
  • Loading branch information
TomHAnderson committed Dec 13, 2023
1 parent 2ad5aa9 commit c12b5d1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
16 changes: 6 additions & 10 deletions src/Resolve/ResolveCollectionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,12 @@ protected function buildPagination(

// Pagination
foreach ($pagination as $field => $value) {
switch ($field) {
case 'after':
$paginationFields[$field] = (int) base64_decode($value, true) + 1;
break;
case 'before':
$paginationFields[$field] = (int) base64_decode($value, true);
break;
default:
$paginationFields[$field] = $value;
break;
if ($field === 'after') {
$paginationFields[$field] = (int) base64_decode($value, true) + 1;
} elseif ($field === 'before') {
$paginationFields[$field] = (int) base64_decode($value, true);
} else {
$paginationFields[$field] = $value;
}
}

Expand Down
16 changes: 6 additions & 10 deletions src/Resolve/ResolveEntityFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,12 @@ public function buildPagination(

if (isset($resolve['args']['pagination'])) {
foreach ($resolve['args']['pagination'] as $field => $value) {
switch ($field) {
case 'after':
$paginationFields[$field] = (int) base64_decode($value, true) + 1;
break;
case 'before':
$paginationFields[$field] = (int) base64_decode($value, true);
break;
default:
$paginationFields[$field] = $value;
break;
if ($field === 'after') {
$paginationFields[$field] = (int) base64_decode($value, true) + 1;
} elseif ($field === 'before') {
$paginationFields[$field] = (int) base64_decode($value, true);
} else {
$paginationFields[$field] = $value;
}
}
}
Expand Down

0 comments on commit c12b5d1

Please sign in to comment.