You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yanzong/vendor/league/flysystem/src/UnableToCreateDirectory.php

45 lines
1.1 KiB

10 months ago
<?php
declare(strict_types=1);
namespace League\Flysystem;
use RuntimeException;
use Throwable;
final class UnableToCreateDirectory extends RuntimeException implements FilesystemOperationFailed
{
/**
* @var string
*/
private $location;
public static function atLocation(string $dirname, string $errorMessage = ''): UnableToCreateDirectory
{
$message = "Unable to create a directory at {$dirname}. ${errorMessage}";
$e = new static(rtrim($message));
$e->location = $dirname;
return $e;
}
public static function dueToFailure(string $dirname, Throwable $previous): UnableToCreateDirectory
{
$message = "Unable to create a directory at {$dirname}";
$e = new static($message, 0, $previous);
$e->location = $dirname;
return $e;
}
public function operation(): string
{
return FilesystemOperationFailed::OPERATION_CREATE_DIRECTORY;
}
public function location(): string
{
return $this->location;
}
}