ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
League\Flysystem\Plugin\ForcedRename Class Reference
+ Inheritance diagram for League\Flysystem\Plugin\ForcedRename:
+ Collaboration diagram for League\Flysystem\Plugin\ForcedRename:

Public Member Functions

 getMethod ()
 Get the method name.
Returns
string
More...
 
 handle ($path, $newpath)
 Renames a file, overwriting the destination if it exists. More...
 
- Public Member Functions inherited from League\Flysystem\Plugin\AbstractPlugin
 setFilesystem (FilesystemInterface $filesystem)
 Set the Filesystem object. More...
 
 getMethod ()
 Get the method name. More...
 
 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 ForcedRename.php.

Member Function Documentation

◆ getMethod()

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

Get the method name.

Returns
string

Implements League\Flysystem\PluginInterface.

Definition at line 12 of file ForcedRename.php.

13 {
14 return 'forceRename';
15 }

◆ handle()

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

Renames a file, overwriting the destination if it exists.

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 ForcedRename.php.

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->rename($path, $newpath);
38 }
39
40 return false;
41 }
$path
Definition: aliased.php:25

References $path.


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