Skip to content

Commit

Permalink
Attempt druc#4 to exclude a path.
Browse files Browse the repository at this point in the history
  • Loading branch information
fszotyi committed Mar 18, 2024
1 parent 6be2124 commit 483b6b8
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/RequiredTranslations.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,18 @@ public function all(): array

private function files(): array
{
$files = $this->disk->allFiles($this->paths);
$allFiles = $this->disk->allFiles($this->paths);

return Collection::make($files)
->filter(fn ($file) => !Str::startsWith($file->getPathName(), $this->excludedPaths))
return Collection::make($allFiles)
->reject(function ($file) {
// Check if file path starts with any of the excluded paths
foreach ($this->excludedPaths as $excludedPath) {
if (Str::startsWith($file->getPathName(), $excludedPath)) {
return true;
}
}
return false;
})
->toArray();
}

Expand Down

0 comments on commit 483b6b8

Please sign in to comment.