Skip to content

Commit

Permalink
Cleanup code
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Dec 10, 2024
1 parent 96c8e65 commit 4c68ae6
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Illuminate\Support\Facades\File;
use Illuminate\Support\ServiceProvider;

use Symfony\Component\Finder\SplFileInfo;
use function Hyde\path_join;
use function str_replace;
use function sprintf;
Expand Down Expand Up @@ -120,13 +121,10 @@ protected function handleInteractivePublish(): void
$source = key($paths);
$target = $paths[$source];

$sourceBaseDir = basename($source);
$targetBaseDir = basename($target);

// Now we need an array that maps all source files to their target paths retaining the directory structure
$search = File::allFiles($source);

$files = collect($search)->mapWithKeys(function (\Symfony\Component\Finder\SplFileInfo $file) use ($source, $target, $sourceBaseDir, $targetBaseDir) {
$files = collect($search)->mapWithKeys(/** @return array<string, string> */ function (SplFileInfo $file) use ($source, $target): array {
$targetPath = path_join($target, $file->getRelativePathname());

return [Hyde::pathToRelative(realpath($file->getPathname())) => Hyde::pathToRelative($targetPath)];
Expand Down

0 comments on commit 4c68ae6

Please sign in to comment.