Skip to content

Commit

Permalink
Allow method based config overwrites.
Browse files Browse the repository at this point in the history
  • Loading branch information
frankdejonge committed Oct 19, 2023
1 parent 8e5ac91 commit 8cca689
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,12 @@ private function pipeListing(string $location, bool $deep, iterable $listing): G

public function move(string $source, string $destination, array $config = []): void
{
$config = $this->config->extend($config);
$from = $this->pathNormalizer->normalizePath($source);
$to = $this->pathNormalizer->normalizePath($destination);

if ($from === $to) {
$resolutionStrategy = $this->config->get(
$resolutionStrategy = $config->get(
Config::OPTION_MOVE_DESTINATION_SAME_AS_SOURCE,
ResolveSameSourceAndDestinationConflict::TRY,
);
Expand All @@ -134,16 +135,18 @@ public function move(string $source, string $destination, array $config = []): v
return;
}
}
$this->adapter->move($from, $to, $this->config->extend($config));

$this->adapter->move($from, $to, $config);
}

public function copy(string $source, string $destination, array $config = []): void
{
$config = $this->config->extend($config);
$from = $this->pathNormalizer->normalizePath($source);
$to = $this->pathNormalizer->normalizePath($destination);

if ($from === $to) {
$resolutionStrategy = $this->config->get(
$resolutionStrategy = $config->get(
Config::OPTION_COPY_DESTINATION_SAME_AS_SOURCE,
ResolveSameSourceAndDestinationConflict::TRY,
);
Expand All @@ -155,7 +158,7 @@ public function copy(string $source, string $destination, array $config = []): v
}
}

$this->adapter->copy($from, $to, $this->config->extend($config));
$this->adapter->copy($from, $to, $config);
}

public function lastModified(string $path): int
Expand Down

0 comments on commit 8cca689

Please sign in to comment.