private function putFile(MountManager $mountManager, string $from, string $to, array $config): bool
    {
        $this->logger->debug("Copying file $from to $to");
        list($prefixFrom, $from) = $mountManager->getPrefixAndPath($from);
        $buffer = $mountManager->getFilesystem($prefixFrom)->readStream($from);

        if ($buffer === false) {
            return false;
        }

        list($prefixTo, $to) = $mountManager->getPrefixAndPath($to);

        $result = $mountManager->getFilesystem($prefixTo)->putStream($to, $buffer, $config);

        if (is_resource($buffer)) {
            fclose($buffer);
        }

        return $result;
    }
private function putFile(MountManager $mountManager, string $from, string $to, array $config): bool
    {
        $this->logger->debug("Copying file $from to $to");
        list($prefixFrom, $from) = $mountManager->getPrefixAndPath($from);
        $buffer = $mountManager->getFilesystem($prefixFrom)->readStream($from);

        if ($buffer === false) {
            return false;
        }

        list($prefixTo, $to) = $mountManager->getPrefixAndPath($to);

        $result = $mountManager->getFilesystem($prefixTo)->putStream($to, $buffer, $config);

        if (is_resource($buffer)) {
            fclose($buffer);
        }

        return $result;
    }
private function putFile ( MountManager $ mountManager , string $ from , string $ to , array $ config ) : bool { $ this -> logger -> debug ( "Copying file $from to $to" ) ; list ( $ prefixFrom , $ from ) = $ mountManager -> getPrefixAndPath ( $ from ) ; $ buffer = $ mountManager -> getFilesystem ( $ prefixFrom ) -> readStream ( $ from ) ; if ( $ buffer === false ) { return false ; } list ( $ prefixTo , $ to ) = $ mountManager -> getPrefixAndPath ( $ to ) ; $ result = $ mountManager -> getFilesystem ( $ prefixTo ) -> putStream ( $ to , $ buffer , $ config ) ; if ( is_resource ( $ buffer ) ) { fclose ( $ buffer ) ; } return $ result ; }
This method is the same as copy, except that it does a putStream rather than writeStream, allowing it to write
even if the file exists.

@param MountManager $mountManager
@param string       $from
@param string       $to
@param array        $config

@return bool
This method is the same as copy except that it does a putStream rather than writeStream allowing it to write even if the file exists .