ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
League\Flysystem\Plugin\ForcedCopy Class Reference
+ Inheritance diagram for League\Flysystem\Plugin\ForcedCopy:
+ Collaboration diagram for League\Flysystem\Plugin\ForcedCopy:

Public Member Functions

 getMethod ()
 Get the method name.
Returns
string
More...
 
 handle ($path, $newpath)
 Copies a file, overwriting any existing files. More...
 
- Public Member Functions inherited from League\Flysystem\Plugin\AbstractPlugin
 setFilesystem (FilesystemInterface $filesystem)
 Set the Filesystem object. More...
 

Additional Inherited Members

- Protected Attributes inherited from League\Flysystem\Plugin\AbstractPlugin
 $filesystem
 

Detailed Description

Definition at line 7 of file ForcedCopy.php.

Member Function Documentation

◆ getMethod()

League\Flysystem\Plugin\ForcedCopy::getMethod ( )

Get the method name.

Returns
string

Implements League\Flysystem\PluginInterface.

Definition at line 12 of file ForcedCopy.php.

13  {
14  return 'forceCopy';
15  }

◆ handle()

League\Flysystem\Plugin\ForcedCopy::handle (   $path,
  $newpath 
)

Copies a file, overwriting any existing files.

Parameters
string$pathPath to the existing file.
string$newpathThe new path of the file.
Exceptions
FileNotFoundExceptionThrown if $path does not exist.
Returns
bool True on success, false on failure.

Definition at line 27 of file ForcedCopy.php.

References $path.

28  {
29  try {
30  $deleted = $this->filesystem->delete($newpath);
31  } catch (FileNotFoundException $e) {
32  // The destination path does not exist. That's ok.
33  $deleted = true;
34  }
35 
36  if ($deleted) {
37  return $this->filesystem->copy($path, $newpath);
38  }
39 
40  return false;
41  }

The documentation for this class was generated from the following file: