From cf4741d9a678ddd9f8d7bef04381a6d6feb34f88 Mon Sep 17 00:00:00 2001 From: Puleeno <puleeno@gmail.com> Date: Sat, 6 Apr 2024 11:31:31 +0700 Subject: [PATCH] Move exceptions to framework package --- app/Common/Option.php | 2 +- .../CanNotResolveParamException.php | 9 --------- app/Exceptions/ClassNotFoundException.php | 13 ------------ app/Exceptions/ContainerException.php | 9 --------- app/Exceptions/ExtensionException.php | 16 --------------- .../InvalidApplicationException.php | 9 --------- app/Exceptions/InvalidAssetTypeException.php | 20 ------------------- app/Exceptions/InvalidTemplateException.php | 9 --------- app/Exceptions/NotCallableException.php | 18 ----------------- app/Exceptions/NotFoundExtensionException.php | 13 ------------ 10 files changed, 1 insertion(+), 117 deletions(-) delete mode 100644 app/Exceptions/CanNotResolveParamException.php delete mode 100644 app/Exceptions/ClassNotFoundException.php delete mode 100644 app/Exceptions/ContainerException.php delete mode 100644 app/Exceptions/ExtensionException.php delete mode 100644 app/Exceptions/InvalidApplicationException.php delete mode 100644 app/Exceptions/InvalidAssetTypeException.php delete mode 100644 app/Exceptions/InvalidTemplateException.php delete mode 100644 app/Exceptions/NotCallableException.php delete mode 100644 app/Exceptions/NotFoundExtensionException.php diff --git a/app/Common/Option.php b/app/Common/Option.php index eb9b5f4..1542b88 100644 --- a/app/Common/Option.php +++ b/app/Common/Option.php @@ -3,7 +3,7 @@ namespace App\Common; use Quagga\Quagga\Helper; -use App\Exceptions\ClassNotFoundException; +use Quagga\Quagga\Exceptions\ClassNotFoundException; use ReflectionClass; final class Option diff --git a/app/Exceptions/CanNotResolveParamException.php b/app/Exceptions/CanNotResolveParamException.php deleted file mode 100644 index 1748f97..0000000 --- a/app/Exceptions/CanNotResolveParamException.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -namespace App\Exceptions; - -use Exception; - -class CanNotResolveParamException extends Exception -{ -} diff --git a/app/Exceptions/ClassNotFoundException.php b/app/Exceptions/ClassNotFoundException.php deleted file mode 100644 index 046a7a2..0000000 --- a/app/Exceptions/ClassNotFoundException.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php - -namespace App\Exceptions; - -use Exception; - -class ClassNotFoundException extends Exception -{ - public function __construct($className, $code = null) - { - parent::__construct(sprintf('Class "%s" not found', $className), $code); - } -} diff --git a/app/Exceptions/ContainerException.php b/app/Exceptions/ContainerException.php deleted file mode 100644 index d7b4f43..0000000 --- a/app/Exceptions/ContainerException.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -namespace Quagga\Exceptions; - -use Exception; - -class ContainerException extends Exception -{ -} diff --git a/app/Exceptions/ExtensionException.php b/app/Exceptions/ExtensionException.php deleted file mode 100644 index 887026a..0000000 --- a/app/Exceptions/ExtensionException.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -namespace App\Exceptions; - -use Exception; - -/** - * Extension Exeption definitions - * - * Error codes: - * - * 100 - */ -class ExtensionException extends Exception -{ -} diff --git a/app/Exceptions/InvalidApplicationException.php b/app/Exceptions/InvalidApplicationException.php deleted file mode 100644 index fea0734..0000000 --- a/app/Exceptions/InvalidApplicationException.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -namespace Quagga\Exceptions; - -use Exception; - -class InvalidApplicationException extends Exception -{ -} diff --git a/app/Exceptions/InvalidAssetTypeException.php b/app/Exceptions/InvalidAssetTypeException.php deleted file mode 100644 index 9639fd8..0000000 --- a/app/Exceptions/InvalidAssetTypeException.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php - -namespace App\Exceptions; - -use Quagga\Quagga\Constracts\AssetTypeEnum; -use Exception; - -class InvalidAssetTypeException extends Exception -{ - public function __construct(AssetTypeEnum $assetTypeEnum, $code = 0) - { - $message = ""; - if (is_null($assetTypeEnum)) { - $message = 'The asset type is null'; - } else { - $message = 'The asset type value `' + $assetTypeEnum->getType() + '` is invalid'; - } - parent::__construct($message, $code); - } -} diff --git a/app/Exceptions/InvalidTemplateException.php b/app/Exceptions/InvalidTemplateException.php deleted file mode 100644 index 9f725dd..0000000 --- a/app/Exceptions/InvalidTemplateException.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -namespace App\Exceptions; - -use Exception; - -class InvalidTemplateException extends Exception -{ -} diff --git a/app/Exceptions/NotCallableException.php b/app/Exceptions/NotCallableException.php deleted file mode 100644 index e127a05..0000000 --- a/app/Exceptions/NotCallableException.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -namespace App\Exceptions; - -use RuntimeException; - -class NotCallableException extends RuntimeException -{ - public function __construct($callable = '', $code = 0) - { - if ($callable !== '') { - $message = sprintf('%s is not callable', $callable); - } else { - $message = $callable; - } - parent::__construct($message, $code); - } -} diff --git a/app/Exceptions/NotFoundExtensionException.php b/app/Exceptions/NotFoundExtensionException.php deleted file mode 100644 index 71376be..0000000 --- a/app/Exceptions/NotFoundExtensionException.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php - -namespace App\Exceptions; - -use Exception; - -class NotFoundExtensionException extends Exception -{ - public function __construct($extension, $code = 0) - { - parent::__construct(sprintf('Extension "%s" not found', $extension), $code); - } -}