本文整理汇总了PHP中League\Flysystem\FilesystemInterface::copy方法的典型用法代码示例。如果您正苦于以下问题:PHP FilesystemInterface::copy方法的具体用法?PHP FilesystemInterface::copy怎么用?PHP FilesystemInterface::copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类League\Flysystem\FilesystemInterface
的用法示例。
在下文中一共展示了FilesystemInterface::copy方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: copyFile
protected function copyFile($fromFullPath, $toFullPath, $replace = false)
{
$this->createDirectory(dirname($toFullPath));
if ($replace) {
$this->filesystem->delete($toFullPath);
}
if (!$this->filesystem->copy($fromFullPath, $toFullPath)) {
throw new CommandErrorException('File cannot be copied to the path ' . $toFullPath);
}
}
示例2: _copy
/**
* Copy file into another file
*
* @param string $source source file path
* @param string $target target directory path
* @param string $name new file name
* @return string|bool
**/
protected function _copy($source, $target, $name)
{
$path = $this->_joinPath($target, $name);
if ($this->fs->copy($source, $path) === false) {
return false;
}
return $path;
}
示例3: copy
/**
* Copy a file.
*
* @param string $source
* @param string $destination
* @throws IoWriteException
*/
public function copy($source, $destination)
{
try {
$this->fs->copy($source, $destination);
} catch (Error $ex) {
throw new IoWriteException("File {$source} could not have benn copied to {$destination}.", $ex);
} catch (Exception $ex) {
throw new IoWriteException("File {$source} could not have benn copied to {$destination}.", $ex);
}
}
示例4: copyFolderRecursively
/**
* @param string $trimmedSourcePath
* @param string $trimmedTargetPath
* @return bool
*/
protected function copyFolderRecursively($trimmedSourcePath, $trimmedTargetPath)
{
try {
$contents = $this->filesystem->listContents($trimmedSourcePath, true);
foreach ($contents as $item) {
if ('file' === $item['type']) {
try {
$relPath = substr_replace($trimmedSourcePath, '', 0, strlen($item['path']));
$targetPath = $trimmedTargetPath . $relPath . '/' . $item['basename'];
$this->filesystem->copy($item['path'], $targetPath);
} catch (FileExistsException $fee) {
continue;
} catch (FileNotFoundException $fnfe) {
return false;
}
}
}
} catch (\Exception $e) {
return false;
}
return true;
}
示例5: copy
/**
* Copy a file to a new location.
*
* @param string $from
* @param string $to
* @return bool
*/
public function copy($from, $to)
{
return $this->driver->copy($from, $to);
}
示例6: _copy
/**
* Copy file into another file
*
* @param string $source source file path
* @param string $target target directory path
* @param string $name new file name
* @return bool
**/
protected function _copy($source, $target, $name)
{
return $this->fs->copy($source, $this->_joinPath($target, $name));
}
示例7: move
/**
* Move a file to a new location.
*
* @param string $from
* @param string $to
* @return bool
*/
public function move($from, $to)
{
$this->driver->copy($from, $to);
$this->driver->delete($from);
}
示例8: _copy
/**
* Copy file into another file
*
* @param string $source source file path
* @param string $target target directory path
* @param string $name new file name
* @return string|bool
**/
protected function _copy($source, $target, $name)
{
$path = $this->_joinPath($target, $name);
return $this->_resultPath($this->fs->copy($source, $path), $path);
}
示例9: copy
/**
* Copy a file.
*
* @param string $path Path to the existing file.
* @param string $newpath The new path of the file.
*
* @throws FileExistsException Thrown if $newpath exists.
* @throws FileNotFoundException Thrown if $path does not exist.
*
* @return bool True on success, false on failure.
*/
public function copy($path, $newpath)
{
return $this->fileSystem->copy($path, $newpath);
}