From 8cca6898eb4820dc331e9f0df0c234c39361d7a4 Mon Sep 17 00:00:00 2001 From: Frank de Jonge Date: Thu, 19 Oct 2023 23:08:21 +0200 Subject: [PATCH] Allow method based config overwrites. --- src/Filesystem.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Filesystem.php b/src/Filesystem.php index 0ed17a32b..0d429960a 100644 --- a/src/Filesystem.php +++ b/src/Filesystem.php @@ -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, ); @@ -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, ); @@ -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