Skip to content

Commit 3e63cc8

Browse files
author
larry.sulebalogun
committed
10 - Remove manual loop for clean code readability
1 parent e7dd120 commit 3e63cc8

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

src/Capability/Registry.php

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -409,18 +409,6 @@ private function paginateResults(array $items, int $limit, ?string $cursor = nul
409409
}
410410
}
411411

412-
$result = [];
413-
$count = 0;
414-
$currentIndex = 0;
415-
416-
foreach ($items as $item) {
417-
if ($currentIndex >= $offset && $count < $limit) {
418-
$result[] = $item;
419-
++$count;
420-
}
421-
++$currentIndex;
422-
}
423-
424-
return $result;
412+
return array_values(\array_slice($items, $offset, $limit));
425413
}
426414
}

0 commit comments

Comments
 (0)