UnableToCopyFile.php 964 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. declare(strict_types=1);
  3. namespace League\Flysystem;
  4. use RuntimeException;
  5. use Throwable;
  6. final class UnableToCopyFile extends RuntimeException implements FilesystemOperationFailed
  7. {
  8. /**
  9. * @var string
  10. */
  11. private $source;
  12. /**
  13. * @var string
  14. */
  15. private $destination;
  16. public function source(): string
  17. {
  18. return $this->source;
  19. }
  20. public function destination(): string
  21. {
  22. return $this->destination;
  23. }
  24. public static function fromLocationTo(
  25. string $sourcePath,
  26. string $destinationPath,
  27. Throwable $previous = null
  28. ): UnableToCopyFile {
  29. $e = new static("Unable to copy file from $sourcePath to $destinationPath", 0 , $previous);
  30. $e->source = $sourcePath;
  31. $e->destination = $destinationPath;
  32. return $e;
  33. }
  34. public function operation(): string
  35. {
  36. return FilesystemOperationFailed::OPERATION_COPY;
  37. }
  38. }