From c151d29b4618e405aaebdd5aba4d509fa5181c6a Mon Sep 17 00:00:00 2001 From: Netkas Date: Sun, 20 Aug 2023 21:20:13 -0400 Subject: [PATCH] - Removed unused exception `UnsupportedComponentTypeException` in `\ncc\Exceptions` in favor of `NotSupportedException` - Removed unused exception `UnsupportedPackageException` in `\ncc\Exceptions` (not used) - Removed unused exception `UnsupportedRemoteTypeSource` in `\ncc\Exceptions` (not used) - Removed unused exception `UnsupportedProjectTypeException` in `\ncc\Exceptions` (not used) --- CHANGELOG.md | 4 ++ scratch/exceptions_plan.txt | 6 +-- .../Classes/NccExtension/PackageCompiler.php | 3 +- src/ncc/Classes/PhpExtension/PhpInstaller.php | 7 ++-- src/ncc/Enums/ExceptionCodes.php | 18 --------- .../UnsupportedComponentTypeException.php | 39 ------------------ .../UnsupportedExtensionVersionException.php | 39 ------------------ .../UnsupportedPackageException.php | 39 ------------------ .../UnsupportedProjectTypeException.php | 40 ------------------- .../UnsupportedRemoteSourceTypeException.php | 39 ------------------ src/ncc/Interfaces/InstallerInterface.php | 2 - 11 files changed, 11 insertions(+), 225 deletions(-) delete mode 100644 src/ncc/Exceptions/UnsupportedComponentTypeException.php delete mode 100644 src/ncc/Exceptions/UnsupportedExtensionVersionException.php delete mode 100644 src/ncc/Exceptions/UnsupportedPackageException.php delete mode 100644 src/ncc/Exceptions/UnsupportedProjectTypeException.php delete mode 100644 src/ncc/Exceptions/UnsupportedRemoteSourceTypeException.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 1acf8b0..f2cf9cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -126,6 +126,10 @@ features. - Removed unused exception `NotImplementedException` in `\ncc\Exceptions` in favor of `NotSupportedException` - Removed unused exception `UnsupportedCompilerExtensionException` in `\ncc\Exceptions` in favor of `NotSupportedException` - Removed unused exception `UnsupportedExtensionVersionException` in `\ncc\Exceptions` (not used) + - Removed unused exception `UnsupportedComponentTypeException` in `\ncc\Exceptions` in favor of `NotSupportedException` + - Removed unused exception `UnsupportedPackageException` in `\ncc\Exceptions` (not used) + - Removed unused exception `UnsupportedRemoteTypeSource` in `\ncc\Exceptions` (not used) + - Removed unused exception `UnsupportedProjectTypeException` in `\ncc\Exceptions` (not used) diff --git a/scratch/exceptions_plan.txt b/scratch/exceptions_plan.txt index 8e162ac..53459de 100644 --- a/scratch/exceptions_plan.txt +++ b/scratch/exceptions_plan.txt @@ -66,9 +66,9 @@ NotSupportedException * NOT_IMPLEMENTED * UNSUPPORTED_COMPILER_EXTENSION * UNSUPPORTED_EXTENSION_VERSION - UNSUPPORTED_COMPONENT_TYPE - NOT_SUPPORTED_EXCEPTION - UNSUPPORTED_PROJECT_TYPE + * UNSUPPORTED_COMPONENT_TYPE + * NOT_SUPPORTED_EXCEPTION + * UNSUPPORTED_PROJECT_TYPE RuntimeException RUNTIME diff --git a/src/ncc/Classes/NccExtension/PackageCompiler.php b/src/ncc/Classes/NccExtension/PackageCompiler.php index c3de69a..801390a 100644 --- a/src/ncc/Classes/NccExtension/PackageCompiler.php +++ b/src/ncc/Classes/NccExtension/PackageCompiler.php @@ -40,7 +40,6 @@ use ncc\Exceptions\PathNotFoundException; use ncc\Exceptions\ProjectConfigurationNotFoundException; use ncc\Exceptions\RunnerExecutionException; - use ncc\Exceptions\UnsupportedProjectTypeException; use ncc\Interfaces\CompilerInterface; use ncc\Managers\ProjectManager; use ncc\ncc; @@ -133,7 +132,7 @@ } else { - throw new UnsupportedProjectTypeException('The project type \'' . $project_type->ProjectType . '\' is not supported'); + throw new NotSupportedException(sprintf('Failed to compile %s, project type %s is not supported', $project_type->ProjectPath, $project_type->ProjectType)); } if($version !== null) diff --git a/src/ncc/Classes/PhpExtension/PhpInstaller.php b/src/ncc/Classes/PhpExtension/PhpInstaller.php index 74ea109..45451aa 100644 --- a/src/ncc/Classes/PhpExtension/PhpInstaller.php +++ b/src/ncc/Classes/PhpExtension/PhpInstaller.php @@ -33,9 +33,9 @@ use ncc\Exceptions\ComponentChecksumException; use ncc\Exceptions\ComponentDecodeException; use ncc\Exceptions\IOException; + use ncc\Exceptions\NotSupportedException; use ncc\Exceptions\PathNotFoundException; use ncc\Exceptions\ResourceChecksumException; - use ncc\Exceptions\UnsupportedComponentTypeException; use ncc\Interfaces\InstallerInterface; use ncc\Objects\InstallationPaths; use ncc\Objects\Package; @@ -78,7 +78,7 @@ * @return string|null * @throws ComponentChecksumException * @throws ComponentDecodeException - * @throws UnsupportedComponentTypeException + * @throws NotSupportedException */ public function processComponent(Package\Component $component): ?string { @@ -113,7 +113,7 @@ return $component->data; default: - throw new UnsupportedComponentTypeException('Unsupported component type \'' . $component->data_types . '\''); + throw new NotSupportedException(sprintf('Component data type %s is not supported.', $component->data_types)); } } @@ -294,7 +294,6 @@ * @param string $src * @param string $output * @return string - * @throws AccessDeniedException * @throws CollectorException * @throws IOException * @throws PathNotFoundException diff --git a/src/ncc/Enums/ExceptionCodes.php b/src/ncc/Enums/ExceptionCodes.php index 98ea0ad..3d53113 100644 --- a/src/ncc/Enums/ExceptionCodes.php +++ b/src/ncc/Enums/ExceptionCodes.php @@ -153,11 +153,6 @@ */ public const INSTALLATION_EXCEPTION = -1730; - /** - * @see UnsupportedComponentTypeException - */ - public const UNSUPPORTED_COMPONENT_TYPE = -1731; - /** * @see ComponentDecodeException */ @@ -253,11 +248,6 @@ */ public const HTTP_EXCEPTION = -1752; - /** - * @see UnsupportedRemoteSourceTypeException - */ - public const UNSUPPORTED_REMOTE_SOURCE_TYPE = -1753; - /** * @see ImportException */ @@ -273,11 +263,6 @@ */ public const NOT_SUPPORTED_EXCEPTION = -1761; - /** - * @see UnsupportedProjectTypeException - */ - public const UNSUPPORTED_PROJECT_TYPE = -1762; - /** * @see ArchiveException */ @@ -347,7 +332,6 @@ self::PACKAGE_PARSING_EXCEPTION, self::PACKAGE_LOCK_EXCEPTION, self::INSTALLATION_EXCEPTION, - self::UNSUPPORTED_COMPONENT_TYPE, self::COMPONENT_DECODE_EXCEPTION, self::RESOURCE_CHECKSUM_EXCEPTION, self::IO_EXCEPTION, @@ -366,10 +350,8 @@ self::USER_ABORTED_OPERATION, self::MISSING_DEPENDENCY, self::HTTP_EXCEPTION, - self::UNSUPPORTED_REMOTE_SOURCE_TYPE, self::AUTHENTICATION_EXCEPTION, self::NOT_SUPPORTED_EXCEPTION, - self::UNSUPPORTED_PROJECT_TYPE, self::ARCHIVE_EXCEPTION, self::PACKAGE_FETCH_EXCEPTION, self::INVALID_BUILD_CONFIGURATION, diff --git a/src/ncc/Exceptions/UnsupportedComponentTypeException.php b/src/ncc/Exceptions/UnsupportedComponentTypeException.php deleted file mode 100644 index 76cdc54..0000000 --- a/src/ncc/Exceptions/UnsupportedComponentTypeException.php +++ /dev/null @@ -1,39 +0,0 @@ -