Skip to content

Commit 8b947d9

Browse files
committed
Small optimization
1 parent 057ae36 commit 8b947d9

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/Testing/FakeFolderRepository.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,15 @@ public function firstOrCreate(string $path): FolderInterface
6060
*/
6161
public function get(?string $match = '*', ?string $reference = ''): FolderCollection
6262
{
63-
return FolderCollection::make($this->folders)->filter(
64-
fn (FolderInterface $folder) => Str::is($match, $folder->path())
65-
);
63+
$folders = FolderCollection::make($this->folders);
64+
65+
// If we're not matching all, filter the folders by the match pattern.
66+
if (! in_array($match, ['*', null])) {
67+
return $folders->filter(
68+
fn (FolderInterface $folder) => Str::is($match, $folder->path())
69+
);
70+
}
71+
72+
return $folders;
6673
}
6774
}

0 commit comments

Comments
 (0)