| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace League\Flysystem; |
| 6 |
|
| 7 |
use RuntimeException; |
| 8 |
use Throwable; |
| 9 |
|
| 10 |
final class UnableToGeneratePublicUrl extends RuntimeException implements FilesystemException |
| 11 |
{ |
| 12 |
public function __construct(string $reason, string $path, ?Throwable $previous = null) |
| 13 |
{ |
| 14 |
parent::__construct("Unable to generate public url for $path: $reason", 0, $previous); |
| 15 |
} |
| 16 |
|
| 17 |
public static function dueToError(string $path, Throwable $exception): static |
| 18 |
{ |
| 19 |
return new static($exception->getMessage(), $path, $exception); |
| 20 |
} |
| 21 |
|
| 22 |
public static function noGeneratorConfigured(string $path, string $extraReason = ''): static |
| 23 |
{ |
| 24 |
return new static('No generator was configured ' . $extraReason, $path); |
| 25 |
} |
| 26 |
} |
| 27 |
|