Skip to content

Commit 1a33166

Browse files
committed
reduce repetitive logic
1 parent e61c61c commit 1a33166

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Finder.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,10 @@ public static function partition(
188188

189189
foreach ($data as $key => $datum) {
190190
$isFound = $filter($datum, $key);
191+
$useOriginalKey = $preserveKey || ! is_numeric($key);
191192

192193
if ($isFound) {
193-
if ($preserveKey || ! is_numeric($key)) {
194+
if ($useOriginalKey) {
194195
$matching[$key] = $datum;
195196
} else {
196197
$matching[$matchKey] = $datum;
@@ -200,7 +201,7 @@ public static function partition(
200201
continue;
201202
}
202203

203-
if ($preserveKey || ! is_numeric($key)) {
204+
if ($useOriginalKey) {
204205
$notMatching[$key] = $datum;
205206
continue;
206207
}

0 commit comments

Comments
 (0)