diff --git a/Exceptions/IO/Filesystem/DirectoryAlreadyExistsException.php b/Exceptions/IO/Filesystem/DirectoryAlreadyExistsException.php new file mode 100644 index 0000000..9e99205 --- /dev/null +++ b/Exceptions/IO/Filesystem/DirectoryAlreadyExistsException.php @@ -0,0 +1,22 @@ + + * @license MIT + */ +class DirectoryAlreadyExistsException extends FilesystemException implements AlreadyExistsException +{ + public function __construct( + $message = 'Cannot find specified directory', + $code = 0, + $previous = null + ) { + parent::__construct($message, $code, $previous); + } +} diff --git a/Exceptions/IO/Filesystem/FileAlreadyExistsException.php b/Exceptions/IO/Filesystem/FileAlreadyExistsException.php new file mode 100644 index 0000000..0792067 --- /dev/null +++ b/Exceptions/IO/Filesystem/FileAlreadyExistsException.php @@ -0,0 +1,22 @@ + + * @license MIT + */ +class FileAlreadyExistsException extends FilesystemException implements AlreadyExistsException +{ + public function __construct( + $message = 'Cannot find specified file', + $code = 0, + $previous = null + ) { + parent::__construct($message, $code, $previous); + } +} diff --git a/Exceptions/Tag/AlreadyExistsException.php b/Exceptions/Tag/AlreadyExistsException.php new file mode 100644 index 0000000..ac6cc4b --- /dev/null +++ b/Exceptions/Tag/AlreadyExistsException.php @@ -0,0 +1,15 @@ + + * @license MIT + */ +interface AlreadyExistsException +{ +} diff --git a/Tests/ExceptionTest.php b/Tests/ExceptionTest.php index a24336d..46fb053 100644 --- a/Tests/ExceptionTest.php +++ b/Tests/ExceptionTest.php @@ -34,10 +34,12 @@ public function providesConstructorTestClasses() [\Exceptions\Http\Server\NotImplementedException::class], [\Exceptions\Http\Server\ServiceUnavailableException::class], [\Exceptions\IO\Filesystem\FileNotWritableException::class], + [\Exceptions\IO\Filesystem\FileAlreadyExistsException::class], [\Exceptions\IO\Filesystem\NotAFileException::class], [\Exceptions\IO\Filesystem\NotADirectoryException::class], [\Exceptions\IO\Filesystem\FileNotFoundException::class], [\Exceptions\IO\Filesystem\DirectoryNotWritableException::class], + [\Exceptions\IO\Filesystem\DirectoryAlreadyExistsException::class], [\Exceptions\IO\Filesystem\DirectoryNotFoundException::class], [\Exceptions\IO\Filesystem\FileNotReadableException::class], [\Exceptions\IO\Filesystem\DirectoryNotReadableException::class],