Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/Commands/FindCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Illuminate\Console\Command;
use Illuminate\Support\Arr;
use Themsaid\Langman\Manager;
use Illuminate\Support\Str;

class FindCommand extends Command
{
Expand Down
11 changes: 6 additions & 5 deletions src/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,21 @@ public function files()
});

$filesByFile = $files->groupBy(function ($file) {
$fileName = $file->getBasename('.'.$file->getExtension());
$filePath = str_replace('.' . $file->getExtension(), '', $file->getRelativePathname());
$filePath = array_reverse(explode('/', $filePath, 2))[0];

if (Str::contains($file->getPath(), 'vendor')) {
$fileName = str_replace('.php', '', $file->getFileName());
$filePath = str_replace('.php', '', $file->getFileName());

$packageName = basename(dirname($file->getPath()));

return "{$packageName}::{$fileName}";
return "{$packageName}::{$filePath}";
} else {
return $fileName;
return $filePath;
}
})->map(function ($files) {
return $files->keyBy(function ($file) {
return basename($file->getPath());
return explode('/', str_replace($this->path, '', $file->getRelativePathname()))[0];
})->map(function ($file) {
return $file->getRealPath();
});
Expand Down