diff --git a/src/Exceptions/ArgumentNullException.php b/src/Exceptions/ArgumentNullException.php index a026c19..f38f8ec 100644 --- a/src/Exceptions/ArgumentNullException.php +++ b/src/Exceptions/ArgumentNullException.php @@ -2,14 +2,13 @@ namespace EncoreDigitalGroup\StdLib\Exceptions; -use EncoreDigitalGroup\StdLib\Objects\ExitCode; +use EncoreDigitalGroup\StdLib\Exceptions\NullExceptions\ArgumentNullException as BaseArgumentNullException; -class ArgumentNullException extends BaseException +/** @deprecated use EncoreDigitalGroup\StdLib\Exceptions\NullExceptions\ArgumentNullException instead */ +class ArgumentNullException extends BaseArgumentNullException { public function __construct(string $argumentName = 'Argument') { - $msg = "{$argumentName} is null on {$this->line}, in {$this->file}"; - - parent::__construct($msg, ExitCode::RESOURCE_UNAVAILABLE, $this->getPrevious()); + parent::__construct($argumentName); } } diff --git a/src/Exceptions/DirectoryNotFoundException.php b/src/Exceptions/DirectoryNotFoundException.php index 64fb9ab..dd7ec28 100644 --- a/src/Exceptions/DirectoryNotFoundException.php +++ b/src/Exceptions/DirectoryNotFoundException.php @@ -2,18 +2,13 @@ namespace EncoreDigitalGroup\StdLib\Exceptions; -use EncoreDigitalGroup\StdLib\Objects\ExitCode; +use EncoreDigitalGroup\StdLib\Exceptions\FilesystemExceptions\DirectoryNotFoundException as BaseDirectoryNotFoundException; -class DirectoryNotFoundException extends BaseException +/** @deprecated use EncoreDigitalGroup\StdLib\Exceptions\FilesystemExceptions\DirectoryNotFoundException instead */ +class DirectoryNotFoundException extends BaseDirectoryNotFoundException { public function __construct(?string $path = null) { - if (is_null($path)) { - $msg = str_concat_space('Unable to locate directory on line', $this->line, 'in', $this->file); - } else { - $msg = str_concat_space('Unable to locate directory', $path, 'on line', $this->line, 'in', $this->file); - } - - parent::__construct($msg, ExitCode::RESOURCE_UNAVAILABLE, $this->getPrevious()); + parent::__construct($path); } } diff --git a/src/Exceptions/EmptyExceptions/ArrayEmptyException.php b/src/Exceptions/EmptyExceptions/ArrayEmptyException.php new file mode 100644 index 0000000..c0d6c56 --- /dev/null +++ b/src/Exceptions/EmptyExceptions/ArrayEmptyException.php @@ -0,0 +1,16 @@ +getPrevious()); + } +} diff --git a/src/Exceptions/FileNotFoundException.php b/src/Exceptions/FileNotFoundException.php index 5e22915..607f12d 100644 --- a/src/Exceptions/FileNotFoundException.php +++ b/src/Exceptions/FileNotFoundException.php @@ -2,18 +2,13 @@ namespace EncoreDigitalGroup\StdLib\Exceptions; -use EncoreDigitalGroup\StdLib\Objects\ExitCode; +use EncoreDigitalGroup\StdLib\Exceptions\FilesystemExceptions\FileNotFoundException as BaseFileNotFoundException; -class FileNotFoundException extends BaseException +/** @deprecated use EncoreDigitalGroup\StdLib\Exceptions\FilesystemExceptions\FileNotFoundException instead. */ +class FileNotFoundException extends BaseFileNotFoundException { public function __construct(?string $path = null) { - if (is_null($path)) { - $msg = str_concat_space('Unable to locate file on line', $this->line, 'in', $this->file); - } else { - $msg = str_concat_space('Unable to locate file', $path, 'on line', $this->line, 'in', $this->file); - } - - parent::__construct($msg, ExitCode::RESOURCE_UNAVAILABLE, $this->getPrevious()); + parent::__construct($path); } } diff --git a/src/Exceptions/FilesystemExceptions/DirectoryNotFoundException.php b/src/Exceptions/FilesystemExceptions/DirectoryNotFoundException.php new file mode 100644 index 0000000..a7d2fd6 --- /dev/null +++ b/src/Exceptions/FilesystemExceptions/DirectoryNotFoundException.php @@ -0,0 +1,20 @@ +line, 'in', $this->file); + } else { + $msg = str_concat_space('Unable to locate directory', $path, 'on line', $this->line, 'in', $this->file); + } + + parent::__construct($msg, ExitCode::RESOURCE_UNAVAILABLE, $this->getPrevious()); + } +} diff --git a/src/Exceptions/FilesystemExceptions/FileNotFoundException.php b/src/Exceptions/FilesystemExceptions/FileNotFoundException.php new file mode 100644 index 0000000..6160bd8 --- /dev/null +++ b/src/Exceptions/FilesystemExceptions/FileNotFoundException.php @@ -0,0 +1,20 @@ +line, 'in', $this->file); + } else { + $msg = str_concat_space('Unable to locate file', $path, 'on line', $this->line, 'in', $this->file); + } + + parent::__construct($msg, ExitCode::RESOURCE_UNAVAILABLE, $this->getPrevious()); + } +} diff --git a/src/Exceptions/NullExceptions/ArgumentNullException.php b/src/Exceptions/NullExceptions/ArgumentNullException.php new file mode 100644 index 0000000..cc42dfb --- /dev/null +++ b/src/Exceptions/NullExceptions/ArgumentNullException.php @@ -0,0 +1,16 @@ +line}, in {$this->file}"; + + parent::__construct($msg, ExitCode::RESOURCE_UNAVAILABLE, $this->getPrevious()); + } +} diff --git a/src/Exceptions/NullExceptions/ClassPropertyNullException.php b/src/Exceptions/NullExceptions/ClassPropertyNullException.php new file mode 100644 index 0000000..484079f --- /dev/null +++ b/src/Exceptions/NullExceptions/ClassPropertyNullException.php @@ -0,0 +1,16 @@ +getPrevious()); + } +} diff --git a/src/Exceptions/NullExceptions/NullException.php b/src/Exceptions/NullExceptions/NullException.php new file mode 100644 index 0000000..2f7c745 --- /dev/null +++ b/src/Exceptions/NullExceptions/NullException.php @@ -0,0 +1,16 @@ +getPrevious()); + } +} diff --git a/src/Exceptions/NullExceptions/VariableNullException.php b/src/Exceptions/NullExceptions/VariableNullException.php new file mode 100644 index 0000000..5ad9367 --- /dev/null +++ b/src/Exceptions/NullExceptions/VariableNullException.php @@ -0,0 +1,16 @@ +getPrevious()); + } +}