Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
declare(strict_types=1);
4
 
5
namespace League\Flysystem;
6
 
7
use RuntimeException;
8
use Throwable;
9
 
10
final class UnableToMoveFile extends RuntimeException implements FilesystemOperationFailed
11
{
12
    /**
13
     * @var string
14
     */
15
    private $source;
16
 
17
    /**
18
     * @var string
19
     */
20
    private $destination;
21
 
22
    public function source(): string
23
    {
24
        return $this->source;
25
    }
26
 
27
    public function destination(): string
28
    {
29
        return $this->destination;
30
    }
31
 
32
    public static function fromLocationTo(
33
        string $sourcePath,
34
        string $destinationPath,
35
        Throwable $previous = null
36
    ): UnableToMoveFile {
37
        $message = $previous?->getMessage() ?? "Unable to move file from $sourcePath to $destinationPath";
38
        $e = new static($message, 0, $previous);
39
        $e->source = $sourcePath;
40
        $e->destination = $destinationPath;
41
 
42
        return $e;
43
    }
44
 
45
    public function operation(): string
46
    {
47
        return FilesystemOperationFailed::OPERATION_MOVE;
48
    }
49
}