diff --git a/.idea/scopes/NCC_Source_files.xml b/.idea/scopes/NCC_Source_files.xml index a65b319..74f8cdb 100644 --- a/.idea/scopes/NCC_Source_files.xml +++ b/.idea/scopes/NCC_Source_files.xml @@ -1,3 +1,3 @@ - + \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b6c3a7..5d0584a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,37 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Corrected code-smell and code style issues in `\ncc\Classes > GithubExtension > GithubService` - Corrected code-smell and code style issues in `\ncc\Classes > GitlabExtension > GitlabService` - Corrected code-smell and code style issues in `\ncc\Classes > NccExtension > ConstantCompiler` + - Renamed `Abstracts` namespace to `Enums` + - Updated class type to "final class" in `\ncc\Enums\Options > BuildConfigurationValues` + - Updated class type to "final class" in `\ncc\Enums\Options > InitializeProjectOptions` + - Updated class type to "final class" in `\ncc\Enums\Options > InstallPackageOptions` + - Updated class type to "final class" in `\ncc\Enums\SpecialConstants > AssemblyConstants` + - Updated class type to "final class" in `\ncc\Enums\SpecialConstants > BuildConstants` + - Updated class type to "final class" in `\ncc\Enums\SpecialConstants > DateTimeConstants` + - Updated class type to "final class" in `\ncc\Enums\SpecialConstants > InstallConstants` + - Updated class type to "final class" in `\ncc\Enums\SpecialConstants > RuntimeConstants` + - Updated class type to "final class" in `\ncc\Enums > AuthenticationType` + - Updated class type to "final class" in `\ncc\Enums > CompilerExtensionDefaultVersions` + - Updated class type to "final class" in `\ncc\Enums > CompilerExtensions` + - Updated class type to "final class" in `\ncc\Enums > CompilerExtensionSupportedVersions` + - Updated class type to "final class" in `\ncc\Enums > ComponentDataType` + - Updated class type to "final class" in `\ncc\Enums > ComponentFileExtensions` + - Updated class type to "final class" in `\ncc\Enums > ComposerPackageTypes` + - Updated class type to "final class" in `\ncc\Enums > ComposerStabilityTypes` + - Updated class type to "final class" in `\ncc\Enums > EncoderType` + - Updated class type to "final class" in `\ncc\Enums > ExceptionCodes` + - Updated class type to "final class" in `\ncc\Enums > HttpRequestType` + - Updated class type to "final class" in `\ncc\Enums > HttpStatusCodes` + - Updated class type to "final class" in `\ncc\Enums > LogLevel` + - Updated class type to "final class" in `\ncc\Enums > NccBuildFlags` + - Updated class type to "final class" in `\ncc\Enums > PackageStandardVersions` + - Updated class type to "final class" in `\ncc\Enums > PackageStructureVersions` + - Updated class type to "final class" in `\ncc\Enums > ProjectType` + - Updated class type to "final class" in `\ncc\Enums > RegexPattern` + - Updated class type to "final class" in `\ncc\Enums > RemoteSourceType` + - Updated class type to "final class" in `\ncc\Enums > Runners` + - Updated class type to "final class" in `\ncc\Enums > Scopes` + - Updated class type to "final class" in `\ncc\Enums > Versions` @@ -39,6 +70,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ncc will display a warning if TTY mode cannot be enabled + ## [1.0.2] - 2023-06-29 ### Fixed @@ -58,6 +90,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Dockerfile for building a docker image of NCC + + ## [1.0.1] - 2023-02-07 ### Added @@ -74,6 +108,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - File downloads now cache the URL as a pointer to the file reducing the number of times the same file is downloaded + + ## [1.0.0] - 2022-01-29 ### Added diff --git a/src/installer/installer b/src/installer/installer index 97b31d3..c738989 100644 --- a/src/installer/installer +++ b/src/installer/installer @@ -12,7 +12,7 @@ getVersion(), ConsoleColors::LightMagenta)); + Console::out(Console::formatColor($full_name, ConsoleColors::GREEN) . ' Version: ' . Console::formatColor($component->getVersion(), ConsoleColors::LIGHT_MAGENTA)); } catch (Exception $e) { - Console::outWarning('Cannot determine component version of ' . Console::formatColor($full_name, ConsoleColors::Green)); + Console::outWarning('Cannot determine component version of ' . Console::formatColor($full_name, ConsoleColors::GREEN)); } } diff --git a/src/ncc/Abstracts/ExceptionCodes.php b/src/ncc/Abstracts/ExceptionCodes.php deleted file mode 100644 index 829c983..0000000 --- a/src/ncc/Abstracts/ExceptionCodes.php +++ /dev/null @@ -1,449 +0,0 @@ - Console::formatColor(' └─', ConsoleColors::LightRed), - 'line' => Console::formatColor(' │ ', ConsoleColors::LightRed), - 'cross' => Console::formatColor(' ├─', ConsoleColors::LightRed), + 'corner' => Console::formatColor(' └─', ConsoleColors::LIGHT_RED), + 'line' => Console::formatColor(' │ ', ConsoleColors::LIGHT_RED), + 'cross' => Console::formatColor(' ├─', ConsoleColors::LIGHT_RED), ]; $keys = array_keys($data); @@ -278,8 +278,8 @@ namespace ncc\CLI\Management; continue; Console::out(sprintf('%s=%s (%s)', - Console::formatColor($package, ConsoleColors::LightGreen), - Console::formatColor($version, ConsoleColors::LightMagenta), + Console::formatColor($package, ConsoleColors::LIGHT_GREEN), + Console::formatColor($version, ConsoleColors::LIGHT_MAGENTA), $package_manager->getPackageVersion($package, $version)->Compiler->Extension )); } @@ -287,9 +287,9 @@ namespace ncc\CLI\Management; { unset($e); Console::out(sprintf('%s=%s (%s)', - Console::formatColor($package, ConsoleColors::LightGreen), - Console::formatColor($version, ConsoleColors::LightMagenta), - Console::formatColor('N/A', ConsoleColors::LightRed) + Console::formatColor($package, ConsoleColors::LIGHT_GREEN), + Console::formatColor($version, ConsoleColors::LIGHT_MAGENTA), + Console::formatColor('N/A', ConsoleColors::LIGHT_RED) )); } } @@ -307,7 +307,7 @@ namespace ncc\CLI\Management; $package = ($args['package'] ?? $args['p']); $package_manager = new PackageManager(); - if(Resolver::resolveScope() !== Scopes::System) + if(Resolver::resolveScope() !== Scopes::SYSTEM) { Console::outError('Insufficient permissions to install packages', true, 1); return; @@ -389,12 +389,12 @@ namespace ncc\CLI\Management; if((Functions::cbool($args['skip-dependencies'] ?? false))) { - $installer_options[] = InstallPackageOptions::SkipDependencies; + $installer_options[] = InstallPackageOptions::SKIP_DEPENDENCIES; } if(Functions::cbool($args['reinstall'] ?? false)) { - $installer_options[] = InstallPackageOptions::Reinstall; + $installer_options[] = InstallPackageOptions::REINSTALL; } try @@ -409,23 +409,23 @@ namespace ncc\CLI\Management; Console::out('Package installation details' . PHP_EOL); if(!is_null($package->Assembly->UUID)) - Console::out(' UUID: ' . Console::formatColor($package->Assembly->UUID, ConsoleColors::LightGreen)); + Console::out(' UUID: ' . Console::formatColor($package->Assembly->UUID, ConsoleColors::LIGHT_GREEN)); if(!is_null($package->Assembly->Package)) - Console::out(' Package: ' . Console::formatColor($package->Assembly->Package, ConsoleColors::LightGreen)); + Console::out(' Package: ' . Console::formatColor($package->Assembly->Package, ConsoleColors::LIGHT_GREEN)); if(!is_null($package->Assembly->Name)) - Console::out(' Name: ' . Console::formatColor($package->Assembly->Name, ConsoleColors::LightGreen)); + Console::out(' Name: ' . Console::formatColor($package->Assembly->Name, ConsoleColors::LIGHT_GREEN)); if(!is_null($package->Assembly->Version)) - Console::out(' Version: ' . Console::formatColor($package->Assembly->Version, ConsoleColors::LightGreen)); + Console::out(' Version: ' . Console::formatColor($package->Assembly->Version, ConsoleColors::LIGHT_GREEN)); if(!is_null($package->Assembly->Description)) - Console::out(' Description: ' . Console::formatColor($package->Assembly->Description, ConsoleColors::LightGreen)); + Console::out(' Description: ' . Console::formatColor($package->Assembly->Description, ConsoleColors::LIGHT_GREEN)); if(!is_null($package->Assembly->Product)) - Console::out(' Product: ' . Console::formatColor($package->Assembly->Product, ConsoleColors::LightGreen)); + Console::out(' Product: ' . Console::formatColor($package->Assembly->Product, ConsoleColors::LIGHT_GREEN)); if(!is_null($package->Assembly->Company)) - Console::out(' Company: ' . Console::formatColor($package->Assembly->Company, ConsoleColors::LightGreen)); + Console::out(' Company: ' . Console::formatColor($package->Assembly->Company, ConsoleColors::LIGHT_GREEN)); if(!is_null($package->Assembly->Copyright)) - Console::out(' Copyright: ' . Console::formatColor($package->Assembly->Copyright, ConsoleColors::LightGreen)); + Console::out(' Copyright: ' . Console::formatColor($package->Assembly->Copyright, ConsoleColors::LIGHT_GREEN)); if(!is_null($package->Assembly->Trademark)) - Console::out(' Trademark: ' . Console::formatColor($package->Assembly->Trademark, ConsoleColors::LightGreen)); + Console::out(' Trademark: ' . Console::formatColor($package->Assembly->Trademark, ConsoleColors::LIGHT_GREEN)); Console::out((string)null); if(count($package->Dependencies) > 0) @@ -435,7 +435,7 @@ namespace ncc\CLI\Management; { $require_dependency = false; - if(!in_array(InstallPackageOptions::SkipDependencies, $installer_options)) + if(!in_array(InstallPackageOptions::SKIP_DEPENDENCIES, $installer_options)) { try { @@ -467,8 +467,8 @@ namespace ncc\CLI\Management; if($require_dependency) { $dependencies[] = sprintf(' %s %s', - Console::formatColor($dependency->Name, ConsoleColors::Green), - Console::formatColor($dependency->Version, ConsoleColors::LightMagenta) + Console::formatColor($dependency->Name, ConsoleColors::GREEN), + Console::formatColor($dependency->Version, ConsoleColors::LIGHT_MAGENTA) ); } } @@ -481,17 +481,17 @@ namespace ncc\CLI\Management; } Console::out(sprintf('Extension: %s', - Console::formatColor($package->Header->CompilerExtension->Extension, ConsoleColors::Green) + Console::formatColor($package->Header->CompilerExtension->Extension, ConsoleColors::GREEN) )); if($package->Header->CompilerExtension->MaximumVersion !== null) Console::out(sprintf('Maximum Version: %s', - Console::formatColor($package->Header->CompilerExtension->MaximumVersion, ConsoleColors::LightMagenta) + Console::formatColor($package->Header->CompilerExtension->MaximumVersion, ConsoleColors::LIGHT_MAGENTA) )); if($package->Header->CompilerExtension->MinimumVersion !== null) Console::out(sprintf('Minimum Version: %s', - Console::formatColor($package->Header->CompilerExtension->MinimumVersion, ConsoleColors::LightMagenta) + Console::formatColor($package->Header->CompilerExtension->MinimumVersion, ConsoleColors::LIGHT_MAGENTA) )); if(!$user_confirmation) diff --git a/src/ncc/CLI/Management/ProjectMenu.php b/src/ncc/CLI/Management/ProjectMenu.php index b7ce09e..b774b64 100644 --- a/src/ncc/CLI/Management/ProjectMenu.php +++ b/src/ncc/CLI/Management/ProjectMenu.php @@ -23,9 +23,9 @@ namespace ncc\CLI\Management; use Exception; - use ncc\Abstracts\CompilerExtensionDefaultVersions; - use ncc\Abstracts\CompilerExtensions; - use ncc\Abstracts\CompilerExtensionSupportedVersions; + use ncc\Enums\CompilerExtensionDefaultVersions; + use ncc\Enums\CompilerExtensions; + use ncc\Enums\CompilerExtensionSupportedVersions; use ncc\Exceptions\AccessDeniedException; use ncc\Exceptions\DirectoryNotFoundException; use ncc\Exceptions\FileNotFoundException; @@ -123,7 +123,7 @@ namespace ncc\CLI\Management; { $compiler_extension = strtolower(($args['extension'] ?? $args['ext'])); - if(in_array($compiler_extension, CompilerExtensions::All)) + if(in_array($compiler_extension, CompilerExtensions::ALL)) { $Compiler->Extension = $compiler_extension; } diff --git a/src/ncc/CLI/Management/SourcesMenu.php b/src/ncc/CLI/Management/SourcesMenu.php index 3c6cc25..6ea79cc 100644 --- a/src/ncc/CLI/Management/SourcesMenu.php +++ b/src/ncc/CLI/Management/SourcesMenu.php @@ -23,7 +23,7 @@ namespace ncc\CLI\Management; use Exception; - use ncc\Abstracts\Scopes; + use ncc\Enums\Scopes; use ncc\Exceptions\IOException; use ncc\Managers\RemoteSourcesManager; use ncc\Objects\CliHelpSection; @@ -117,7 +117,7 @@ namespace ncc\CLI\Management; */ public static function addEntry($args): void { - if(Resolver::resolveScope() !== Scopes::System) + if(Resolver::resolveScope() !== Scopes::SYSTEM) { Console::outError('Insufficient permissions to add entry.', true, 1); return; @@ -187,7 +187,7 @@ namespace ncc\CLI\Management; { $ResolvedScope = Resolver::resolveScope(); - if($ResolvedScope !== Scopes::System) + if($ResolvedScope !== Scopes::SYSTEM) Console::outError('Insufficient permissions to remove entries'); $name = $args['name'] ?? null; diff --git a/src/ncc/Classes/ComposerExtension/ComposerSourceBuiltin.php b/src/ncc/Classes/ComposerExtension/ComposerSourceBuiltin.php index 8b6a7be..3f7c21c 100644 --- a/src/ncc/Classes/ComposerExtension/ComposerSourceBuiltin.php +++ b/src/ncc/Classes/ComposerExtension/ComposerSourceBuiltin.php @@ -25,12 +25,12 @@ namespace ncc\Classes\ComposerExtension; use Exception; use FilesystemIterator; use JsonException; - use ncc\Abstracts\CompilerExtensions; - use ncc\Abstracts\CompilerExtensionSupportedVersions; - use ncc\Abstracts\ComponentFileExtensions; - use ncc\Abstracts\DependencySourceType; - use ncc\Abstracts\LogLevel; - use ncc\Abstracts\Scopes; + use ncc\Enums\CompilerExtensions; + use ncc\Enums\CompilerExtensionSupportedVersions; + use ncc\Enums\ComponentFileExtensions; + use ncc\Enums\DependencySourceType; + use ncc\Enums\LogLevel; + use ncc\Enums\Scopes; use ncc\CLI\Main; use ncc\Exceptions\AccessDeniedException; use ncc\Exceptions\BuildConfigurationNotFoundException; @@ -386,7 +386,7 @@ namespace ncc\Classes\ComposerExtension; $dependency = new ProjectConfiguration\Dependency(); $dependency->Name = $package_name; - $dependency->SourceType = DependencySourceType::Local; + $dependency->SourceType = DependencySourceType::LOCAL; $dependency->Version = self::versionMap($item->PackageName, $version_map); $dependency->Source = $package_name . '.ncc'; $project_configuration->Build->addDependency($dependency); @@ -497,22 +497,22 @@ namespace ncc\Classes\ComposerExtension; switch (Main::getLogLevel()) { default: - case LogLevel::Fatal: - case LogLevel::Warning: - case LogLevel::Error: - case LogLevel::Info: + case LogLevel::FATAL: + case LogLevel::WARNING: + case LogLevel::ERROR: + case LogLevel::INFO: $results[] = '-v'; break; - case LogLevel::Verbose: + case LogLevel::VERBOSE: $results[] = '-vv'; break; - case LogLevel::Debug: + case LogLevel::DEBUG: $results[] = '-vvv'; break; - case LogLevel::Silent: + case LogLevel::SILENT: if (!in_array('--quiet', $results, true)) { $results[] = '--quiet'; @@ -545,7 +545,7 @@ namespace ncc\Classes\ComposerExtension; */ private static function require(string $vendor, string $package, ?string $version = null): string { - if (Resolver::resolveScope() !== Scopes::System) + if (Resolver::resolveScope() !== Scopes::SYSTEM) { throw new AccessDeniedException('Insufficient permissions to require'); } @@ -575,7 +575,7 @@ namespace ncc\Classes\ComposerExtension; $template = str_ireplace('%VERSION%', $version, $template); $filesystem = new Filesystem(); - $tmp_dir = PathFinder::getCachePath(Scopes::System) . DIRECTORY_SEPARATOR . hash('haval128,3', $template); + $tmp_dir = PathFinder::getCachePath(Scopes::SYSTEM) . DIRECTORY_SEPARATOR . hash('haval128,3', $template); $composer_json_path = $tmp_dir . DIRECTORY_SEPARATOR . 'composer.json'; if ($filesystem->exists($tmp_dir)) { Console::outVerbose(sprintf('Deleting already existing %s', $tmp_dir)); @@ -668,7 +668,7 @@ namespace ncc\Classes\ComposerExtension; $process->setWorkingDirectory($path); // Check if scripts are enabled while running as root - if (!in_array('--no-scripts', $options, true) && Resolver::resolveScope() === Scopes::System) + if (!in_array('--no-scripts', $options, true) && Resolver::resolveScope() === Scopes::SYSTEM) { Console::outWarning('composer scripts are enabled while running as root, this can allow malicious scripts to run as root'); @@ -777,7 +777,7 @@ namespace ncc\Classes\ComposerExtension; } // Include file components that can be compiled - $DirectoryScanner->setIncludes(ComponentFileExtensions::Php); + $DirectoryScanner->setIncludes(ComponentFileExtensions::PHP); foreach ($source_directories as $directory) { diff --git a/src/ncc/Classes/GithubExtension/GithubService.php b/src/ncc/Classes/GithubExtension/GithubService.php index ebc66f3..b1e24cc 100644 --- a/src/ncc/Classes/GithubExtension/GithubService.php +++ b/src/ncc/Classes/GithubExtension/GithubService.php @@ -22,8 +22,8 @@ namespace ncc\Classes\GithubExtension; - use ncc\Abstracts\HttpRequestType; - use ncc\Abstracts\Versions; + use ncc\Enums\HttpRequestType; + use ncc\Enums\Versions; use ncc\Classes\HttpClient; use ncc\Exceptions\AuthenticationException; use ncc\Exceptions\GithubServiceException; @@ -235,7 +235,7 @@ namespace ncc\Classes\GithubExtension; throw new VersionNotFoundException('No releases found for the given repository.'); } - if ($packageInput->Version === Versions::Latest) + if ($packageInput->Version === Versions::LATEST) { $latest_version = null; foreach ($releases as $release) diff --git a/src/ncc/Classes/GitlabExtension/GitlabService.php b/src/ncc/Classes/GitlabExtension/GitlabService.php index 07161a3..b7f58fd 100644 --- a/src/ncc/Classes/GitlabExtension/GitlabService.php +++ b/src/ncc/Classes/GitlabExtension/GitlabService.php @@ -22,7 +22,7 @@ namespace ncc\Classes\GitlabExtension; - use ncc\Abstracts\Versions; + use ncc\Enums\Versions; use ncc\Classes\HttpClient; use ncc\Exceptions\AuthenticationException; use ncc\Exceptions\GitlabServiceException; @@ -108,7 +108,7 @@ } // Query the latest package only - if($packageInput->Version === Versions::Latest) + if($packageInput->Version === Versions::LATEST) { $latest_version = null; foreach($releases as $release) diff --git a/src/ncc/Classes/HttpClient.php b/src/ncc/Classes/HttpClient.php index 2ce3f3a..bffef0a 100644 --- a/src/ncc/Classes/HttpClient.php +++ b/src/ncc/Classes/HttpClient.php @@ -23,8 +23,8 @@ namespace ncc\Classes; use CurlHandle; - use ncc\Abstracts\HttpRequestType; - use ncc\Abstracts\LogLevel; + use ncc\Enums\HttpRequestType; + use ncc\Enums\LogLevel; use ncc\CLI\Main; use ncc\Exceptions\HttpException; use ncc\Objects\HttpRequest; @@ -60,9 +60,9 @@ namespace ncc\Classes; { switch(Main::getLogLevel()) { - case LogLevel::Verbose: - case LogLevel::Debug: - case LogLevel::Silent: + case LogLevel::VERBOSE: + case LogLevel::DEBUG: + case LogLevel::SILENT: Console::outVerbose(sprintf(' <= %s of %s bytes downloaded', $downloaded, $downloadSize)); break; diff --git a/src/ncc/Classes/NccExtension/ConstantCompiler.php b/src/ncc/Classes/NccExtension/ConstantCompiler.php index 8f81ac4..627561a 100644 --- a/src/ncc/Classes/NccExtension/ConstantCompiler.php +++ b/src/ncc/Classes/NccExtension/ConstantCompiler.php @@ -22,11 +22,11 @@ namespace ncc\Classes\NccExtension; - use ncc\Abstracts\SpecialConstants\BuildConstants; - use ncc\Abstracts\SpecialConstants\DateTimeConstants; - use ncc\Abstracts\SpecialConstants\InstallConstants; - use ncc\Abstracts\SpecialConstants\AssemblyConstants; - use ncc\Abstracts\SpecialConstants\RuntimeConstants; + use ncc\Enums\SpecialConstants\BuildConstants; + use ncc\Enums\SpecialConstants\DateTimeConstants; + use ncc\Enums\SpecialConstants\InstallConstants; + use ncc\Enums\SpecialConstants\AssemblyConstants; + use ncc\Enums\SpecialConstants\RuntimeConstants; use ncc\Objects\InstallationPaths; use ncc\Objects\ProjectConfiguration\Assembly; @@ -48,47 +48,47 @@ namespace ncc\Classes\NccExtension; if($assembly->Name !== null) { - $input = str_replace(AssemblyConstants::AssemblyName, $assembly->Name, $input); + $input = str_replace(AssemblyConstants::ASSEMBLY_NAME, $assembly->Name, $input); } if($assembly->Package !== null) { - $input = str_replace(AssemblyConstants::AssemblyPackage, $assembly->Package, $input); + $input = str_replace(AssemblyConstants::ASSEMBLY_PACKAGE, $assembly->Package, $input); } if($assembly->Description !== null) { - $input = str_replace(AssemblyConstants::AssemblyDescription, $assembly->Description, $input); + $input = str_replace(AssemblyConstants::ASSEMBLY_DESCRIPTION, $assembly->Description, $input); } if($assembly->Company !== null) { - $input = str_replace(AssemblyConstants::AssemblyCompany, $assembly->Company, $input); + $input = str_replace(AssemblyConstants::ASSEMBLY_COMPANY, $assembly->Company, $input); } if($assembly->Product !== null) { - $input = str_replace(AssemblyConstants::AssemblyProduct, $assembly->Product, $input); + $input = str_replace(AssemblyConstants::ASSEMBLY_PRODUCT, $assembly->Product, $input); } if($assembly->Copyright !== null) { - $input = str_replace(AssemblyConstants::AssemblyCopyright, $assembly->Copyright, $input); + $input = str_replace(AssemblyConstants::ASSEMBLY_COPYRIGHT, $assembly->Copyright, $input); } if($assembly->Trademark !== null) { - $input =str_replace(AssemblyConstants::AssemblyTrademark, $assembly->Trademark, $input); + $input =str_replace(AssemblyConstants::ASSEMBLY_TRADEMARK, $assembly->Trademark, $input); } if($assembly->Version !== null) { - $input = str_replace(AssemblyConstants::AssemblyVersion, $assembly->Version, $input); + $input = str_replace(AssemblyConstants::ASSEMBLY_VERSION, $assembly->Version, $input); } if($assembly->UUID !== null) { - $input = str_replace(AssemblyConstants::AssemblyUid, $assembly->UUID, $input); + $input = str_replace(AssemblyConstants::ASSEMBLY_UID, $assembly->UUID, $input); } return $input; @@ -109,10 +109,10 @@ namespace ncc\Classes\NccExtension; return str_replace( [ - BuildConstants::CompileTimestamp, - BuildConstants::NccBuildVersion, - BuildConstants::NccBuildFlags, - BuildConstants::NccBuildBranch + BuildConstants::COMPILE_TIMESTAMP, + BuildConstants::NCC_BUILD_VERSION, + BuildConstants::NCC_BUILD_FLAGS, + BuildConstants::NCC_BUILD_BRANCH ], [ time(), @@ -138,10 +138,10 @@ namespace ncc\Classes\NccExtension; return str_replace( [ - InstallConstants::InstallationPath, - InstallConstants::BinPath, - InstallConstants::SourcePath, - InstallConstants::DataPath + InstallConstants::INSTALL_PATH, + InstallConstants::INSTALL_PATH_BIN, + InstallConstants::INSTALL_PATH_SRC, + InstallConstants::INSTALL_PATH_DATA ], [ $installationPaths->getInstallationPath(), @@ -265,7 +265,7 @@ namespace ncc\Classes\NccExtension; if(function_exists('get_current_user')) { - $input = str_replace(RuntimeConstants::User, get_current_user(), $input); + $input = str_replace(RuntimeConstants::USER, get_current_user(), $input); } return $input; diff --git a/src/ncc/Classes/NccExtension/PackageCompiler.php b/src/ncc/Classes/NccExtension/PackageCompiler.php index 8233e31..d31b206 100644 --- a/src/ncc/Classes/NccExtension/PackageCompiler.php +++ b/src/ncc/Classes/NccExtension/PackageCompiler.php @@ -23,11 +23,11 @@ namespace ncc\Classes\NccExtension; use Exception; - use ncc\Abstracts\CompilerExtensions; - use ncc\Abstracts\ConstantReferences; - use ncc\Abstracts\LogLevel; - use ncc\Abstracts\Options\BuildConfigurationValues; - use ncc\Abstracts\ProjectType; + use ncc\Enums\CompilerExtensions; + use ncc\Enums\ConstantReferences; + use ncc\Enums\LogLevel; + use ncc\Enums\Options\BuildConfigurationValues; + use ncc\Enums\ProjectType; use ncc\Classes\ComposerExtension\ComposerSourceBuiltin; use ncc\Classes\PhpExtension\PhpCompiler; use ncc\CLI\Main; @@ -71,11 +71,11 @@ namespace ncc\Classes\NccExtension; * @throws ProjectConfigurationNotFoundException * @throws UnsupportedCompilerExtensionException */ - public static function compile(ProjectManager $manager, string $build_configuration=BuildConfigurationValues::DefaultConfiguration): string + public static function compile(ProjectManager $manager, string $build_configuration=BuildConfigurationValues::DEFAULT): string { $configuration = $manager->getProjectConfiguration(); - if(Main::getLogLevel() !== null && Resolver::checkLogLevel(LogLevel::Debug, Main::getLogLevel())) + if(Main::getLogLevel() !== null && Resolver::checkLogLevel(LogLevel::DEBUG, Main::getLogLevel())) { foreach($configuration->Assembly->toArray() as $prop => $value) Console::outDebug(sprintf('assembly.%s: %s', $prop, ($value ?? 'n/a'))); @@ -121,11 +121,11 @@ namespace ncc\Classes\NccExtension; try { - if($project_type->ProjectType == ProjectType::Composer) + if($project_type->ProjectType == ProjectType::COMPOSER) { $project_path = ComposerSourceBuiltin::fromLocal($project_type->ProjectPath); } - elseif($project_type->ProjectType == ProjectType::Ncc) + elseif($project_type->ProjectType == ProjectType::NCC) { $project_manager = new ProjectManager($project_type->ProjectPath); $project_manager->getProjectConfiguration()->Assembly->Version = $version; @@ -204,7 +204,7 @@ namespace ncc\Classes\NccExtension; * @throws BuildConfigurationNotFoundException * @throws IOException */ - public static function writePackage(string $path, Package $package, ProjectConfiguration $configuration, string $build_configuration=BuildConfigurationValues::DefaultConfiguration): string + public static function writePackage(string $path, Package $package, ProjectConfiguration $configuration, string $build_configuration=BuildConfigurationValues::DEFAULT): string { Console::outVerbose(sprintf('Writing package to %s', $path)); @@ -373,19 +373,19 @@ namespace ncc\Classes\NccExtension; if($value == null) return null; - if(isset($refs[ConstantReferences::Assembly])) - $value = ConstantCompiler::compileAssemblyConstants($value, $refs[ConstantReferences::Assembly]); + if(isset($refs[ConstantReferences::ASSEMBLY])) + $value = ConstantCompiler::compileAssemblyConstants($value, $refs[ConstantReferences::ASSEMBLY]); - if(isset($refs[ConstantReferences::Build])) + if(isset($refs[ConstantReferences::BUILD])) $value = ConstantCompiler::compileBuildConstants($value); - if(isset($refs[ConstantReferences::DateTime])) - $value = ConstantCompiler::compileDateTimeConstants($value, $refs[ConstantReferences::DateTime]); + if(isset($refs[ConstantReferences::DATE_TIME])) + $value = ConstantCompiler::compileDateTimeConstants($value, $refs[ConstantReferences::DATE_TIME]); - if(isset($refs[ConstantReferences::Install])) - $value = ConstantCompiler::compileInstallConstants($value, $refs[ConstantReferences::Install]); + if(isset($refs[ConstantReferences::INSTALL])) + $value = ConstantCompiler::compileInstallConstants($value, $refs[ConstantReferences::INSTALL]); - if(isset($refs[ConstantReferences::Runtime])) + if(isset($refs[ConstantReferences::RUNTIME])) $value = ConstantCompiler::compileRuntimeConstants($value); return $value; diff --git a/src/ncc/Classes/NccExtension/Runner.php b/src/ncc/Classes/NccExtension/Runner.php index 5a71e81..0d7c631 100644 --- a/src/ncc/Classes/NccExtension/Runner.php +++ b/src/ncc/Classes/NccExtension/Runner.php @@ -22,7 +22,7 @@ namespace ncc\Classes\NccExtension; - use ncc\Abstracts\Scopes; + use ncc\Enums\Scopes; use ncc\Exceptions\AccessDeniedException; use ncc\Exceptions\FileNotFoundException; use ncc\Exceptions\IOException; @@ -49,7 +49,7 @@ namespace ncc\Classes\NccExtension; */ public static function temporaryExecute(string $package, string $version, ExecutionUnit $unit): void { - if(Resolver::resolveScope() !== Scopes::System) + if(Resolver::resolveScope() !== Scopes::SYSTEM) throw new AccessDeniedException('Cannot temporarily execute a unit with insufficient permissions'); $ExecutionPointerManager = new ExecutionPointerManager(); diff --git a/src/ncc/Classes/PhpExtension/PhpCompiler.php b/src/ncc/Classes/PhpExtension/PhpCompiler.php index bc5142b..8475673 100644 --- a/src/ncc/Classes/PhpExtension/PhpCompiler.php +++ b/src/ncc/Classes/PhpExtension/PhpCompiler.php @@ -26,11 +26,11 @@ use Exception; use FilesystemIterator; - use ncc\Abstracts\ComponentFileExtensions; - use ncc\Abstracts\ComponentDataType; - use ncc\Abstracts\ConstantReferences; - use ncc\Abstracts\DependencySourceType; - use ncc\Abstracts\Options\BuildConfigurationValues; + use ncc\Enums\ComponentFileExtensions; + use ncc\Enums\ComponentDataType; + use ncc\Enums\ConstantReferences; + use ncc\Enums\DependencySourceType; + use ncc\Enums\Options\BuildConfigurationValues; use ncc\Classes\NccExtension\PackageCompiler; use ncc\Exceptions\AccessDeniedException; use ncc\Exceptions\BuildConfigurationNotFoundException; @@ -90,7 +90,7 @@ * @throws PackagePreparationFailedException * @throws BuildConfigurationNotFoundException */ - public function prepare(string $build_configuration=BuildConfigurationValues::DefaultConfiguration): void + public function prepare(string $build_configuration=BuildConfigurationValues::DEFAULT): void { try { @@ -149,7 +149,7 @@ } // Include file components that can be compiled - $DirectoryScanner->setIncludes(ComponentFileExtensions::Php); + $DirectoryScanner->setIncludes(ComponentFileExtensions::PHP); if($selected_build_configuration->ExcludeFiles !== null && count($selected_build_configuration->ExcludeFiles) > 0) $DirectoryScanner->setExcludes($selected_build_configuration->ExcludeFiles); $source_path = $this->path . $this->project->Build->SourcePath; @@ -191,11 +191,11 @@ // Ignore component files if($selected_build_configuration->ExcludeFiles !== null && count($selected_build_configuration->ExcludeFiles) > 0) { - $DirectoryScanner->setExcludes(array_merge($selected_build_configuration->ExcludeFiles, ComponentFileExtensions::Php)); + $DirectoryScanner->setExcludes(array_merge($selected_build_configuration->ExcludeFiles, ComponentFileExtensions::PHP)); } else { - $DirectoryScanner->setExcludes(ComponentFileExtensions::Php); + $DirectoryScanner->setExcludes(ComponentFileExtensions::PHP); } Console::outVerbose('Scanning for resources... '); @@ -249,7 +249,7 @@ Console::outVerbose(sprintf('processing dependency %s', $dependency->Name)); switch($dependency->SourceType) { - case DependencySourceType::StaticLinking: + case DependencySourceType::STATIC: try { @@ -277,7 +277,7 @@ break; default: - case DependencySourceType::RemoteSource: + case DependencySourceType::REMOTE: break; } @@ -312,9 +312,9 @@ $this->compileResources(); PackageCompiler::compilePackageConstants($this->package, [ - ConstantReferences::Assembly => $this->project->Assembly, - ConstantReferences::Build => null, - ConstantReferences::DateTime => time() + ConstantReferences::ASSEMBLY => $this->project->Assembly, + ConstantReferences::BUILD => null, + ConstantReferences::DATE_TIME => time() ]); return $this->getPackage(); @@ -407,7 +407,7 @@ if($encoded === false) { - $component->DataType = ComponentDataType::b64encoded; + $component->DataType = ComponentDataType::BASE64_ENCODED; $component->Data = Base64::encode($content); } else @@ -418,7 +418,7 @@ } catch(Exception $e) { - $component->DataType = ComponentDataType::b64encoded; + $component->DataType = ComponentDataType::BASE64_ENCODED; $component->Data = Base64::encode($content); unset($e); } diff --git a/src/ncc/Classes/PhpExtension/PhpInstaller.php b/src/ncc/Classes/PhpExtension/PhpInstaller.php index 323df19..8b90763 100644 --- a/src/ncc/Classes/PhpExtension/PhpInstaller.php +++ b/src/ncc/Classes/PhpExtension/PhpInstaller.php @@ -27,8 +27,8 @@ use ArrayIterator; use Exception; - use ncc\Abstracts\ComponentDataType; - use ncc\Abstracts\ComponentFileExtensions; + use ncc\Enums\ComponentDataType; + use ncc\Enums\ComponentFileExtensions; use ncc\Exceptions\AccessDeniedException; use ncc\Exceptions\ComponentChecksumException; use ncc\Exceptions\ComponentDecodeException; @@ -110,10 +110,10 @@ $prettyPrinter = new Standard(); return $prettyPrinter->prettyPrintFile($stmts); - case ComponentDataType::b64encoded: + case ComponentDataType::BASE64_ENCODED: return Base64::decode($component->Data); - case ComponentDataType::Plain: + case ComponentDataType::PLAIN: return $component->Data; default: @@ -303,7 +303,7 @@ $configuration->setOutputFile($output); $configuration->setStaticMode(false); // Official PHP file extensions that are missing from the default configuration (whatever) - $configuration->setInclude(ComponentFileExtensions::Php); + $configuration->setInclude(ComponentFileExtensions::PHP); $configuration->setQuietMode(true); $configuration->setTolerantMode(true); diff --git a/src/ncc/Classes/PhpExtension/PhpRuntime.php b/src/ncc/Classes/PhpExtension/PhpRuntime.php index 97d3df1..74b7e53 100644 --- a/src/ncc/Classes/PhpExtension/PhpRuntime.php +++ b/src/ncc/Classes/PhpExtension/PhpRuntime.php @@ -23,7 +23,7 @@ namespace ncc\Classes\PhpExtension; use Exception; - use ncc\Abstracts\Options\RuntimeImportOptions; + use ncc\Enums\Options\RuntimeImportOptions; use ncc\Classes\NccExtension\ConstantCompiler; use ncc\Exceptions\ConstantReadonlyException; use ncc\Exceptions\ImportException; @@ -96,12 +96,12 @@ namespace ncc\Classes\PhpExtension; } } - if(file_exists($autoload_path) && !in_array(RuntimeImportOptions::ImportAutoloader, $options)) + if(file_exists($autoload_path) && !in_array(RuntimeImportOptions::IMPORT_AUTOLOADER, $options)) { require_once($autoload_path); } - if(file_exists($static_files) && !in_array(RuntimeImportOptions::ImportStaticFiles, $options)) + if(file_exists($static_files) && !in_array(RuntimeImportOptions::IMPORT_STATIC_FILES, $options)) { try { diff --git a/src/ncc/Abstracts/AuthenticationType.php b/src/ncc/Enums/AuthenticationType.php similarity index 90% rename from src/ncc/Abstracts/AuthenticationType.php rename to src/ncc/Enums/AuthenticationType.php index 5981b9d..332e43b 100644 --- a/src/ncc/Abstracts/AuthenticationType.php +++ b/src/ncc/Enums/AuthenticationType.php @@ -20,17 +20,17 @@ * */ -namespace ncc\Abstracts; + namespace ncc\Enums; - abstract class AuthenticationType + final class AuthenticationType { /** * A combination of a username and password is used for authentication */ - const UsernamePassword = 1; + public const USERNAME_PASSWORD = 1; /** * A single private access token is used for authentication */ - const AccessToken = 2; + public const ACCESS_TOKEN = 2; } \ No newline at end of file diff --git a/src/ncc/Abstracts/BuiltinRemoteSourceType.php b/src/ncc/Enums/BuiltinRemoteSourceType.php similarity index 88% rename from src/ncc/Abstracts/BuiltinRemoteSourceType.php rename to src/ncc/Enums/BuiltinRemoteSourceType.php index 7568d42..560e4e6 100644 --- a/src/ncc/Abstracts/BuiltinRemoteSourceType.php +++ b/src/ncc/Enums/BuiltinRemoteSourceType.php @@ -20,18 +20,18 @@ * */ - namespace ncc\Abstracts; + namespace ncc\Enums; - class BuiltinRemoteSourceType + final class BuiltinRemoteSourceType { /** * The remote source indicates the package is to be * fetched using the composer utility. */ - const Composer = 'composer'; + public const COMPOSER = 'composer'; - const All = [ - self::Composer + public const ALL = [ + self::COMPOSER ]; } \ No newline at end of file diff --git a/src/ncc/Abstracts/CompilerExtensionDefaultVersions.php b/src/ncc/Enums/CompilerExtensionDefaultVersions.php similarity index 92% rename from src/ncc/Abstracts/CompilerExtensionDefaultVersions.php rename to src/ncc/Enums/CompilerExtensionDefaultVersions.php index 3f15481..386f20c 100644 --- a/src/ncc/Abstracts/CompilerExtensionDefaultVersions.php +++ b/src/ncc/Enums/CompilerExtensionDefaultVersions.php @@ -20,14 +20,14 @@ * */ -namespace ncc\Abstracts; + namespace ncc\Enums; - abstract class CompilerExtensionDefaultVersions + final class CompilerExtensionDefaultVersions { // ---------------------------------------------------------------- // [0] = MinimumVersion // [1] = MaximumVersion // ---------------------------------------------------------------- - const PHP = ['8.0', '8.2']; + public const PHP = ['8.0', '8.2']; } \ No newline at end of file diff --git a/src/ncc/Abstracts/CompilerExtensionSupportedVersions.php b/src/ncc/Enums/CompilerExtensionSupportedVersions.php similarity index 90% rename from src/ncc/Abstracts/CompilerExtensionSupportedVersions.php rename to src/ncc/Enums/CompilerExtensionSupportedVersions.php index 3f76ad5..6b31058 100644 --- a/src/ncc/Abstracts/CompilerExtensionSupportedVersions.php +++ b/src/ncc/Enums/CompilerExtensionSupportedVersions.php @@ -20,9 +20,9 @@ * */ -namespace ncc\Abstracts; +namespace ncc\Enums; - abstract class CompilerExtensionSupportedVersions + final class CompilerExtensionSupportedVersions { - const PHP = ['8.0', '8.1', '8.2']; + public const PHP = ['8.0', '8.1', '8.2']; } \ No newline at end of file diff --git a/src/ncc/Abstracts/CompilerExtensions.php b/src/ncc/Enums/CompilerExtensions.php similarity index 90% rename from src/ncc/Abstracts/CompilerExtensions.php rename to src/ncc/Enums/CompilerExtensions.php index 470c695..3db4832 100644 --- a/src/ncc/Abstracts/CompilerExtensions.php +++ b/src/ncc/Enums/CompilerExtensions.php @@ -20,13 +20,13 @@ * */ -namespace ncc\Abstracts; + namespace ncc\Enums; - abstract class CompilerExtensions + final class CompilerExtensions { - const PHP = 'php'; + public const PHP = 'php'; - const All = [ + public const ALL = [ CompilerExtensions::PHP ]; } \ No newline at end of file diff --git a/src/ncc/Abstracts/ComponentDataType.php b/src/ncc/Enums/ComponentDataType.php similarity index 86% rename from src/ncc/Abstracts/ComponentDataType.php rename to src/ncc/Enums/ComponentDataType.php index 0e063b5..882681b 100644 --- a/src/ncc/Abstracts/ComponentDataType.php +++ b/src/ncc/Enums/ComponentDataType.php @@ -20,32 +20,32 @@ * */ -namespace ncc\Abstracts; + namespace ncc\Enums; - abstract class ComponentDataType + final class ComponentDataType { /** * Indicates whether the component is represented as an AST representation */ - const AST = 'ast'; + public const AST = 'ast'; /** * Indicates whether the component is represented as plaintext */ - const Plain = 'plain'; + public const PLAIN = 'plain'; /** * Indicates whether the component is represented as bytecode */ - const Bytecode = 'bytecode'; + public const BYTECODE = 'bytecode'; /** * Indicates whether the component is represented as binary or executable */ - const Binary = 'binary'; + public const BINARY = 'binary'; /** * Indicates whether the component is represented as as a base64 encoded string (Raw bytes' representation) */ - const b64encoded = 'b64enc'; + public const BASE64_ENCODED = 'b64enc'; } \ No newline at end of file diff --git a/src/ncc/Abstracts/ComponentFileExtensions.php b/src/ncc/Enums/ComponentFileExtensions.php similarity index 90% rename from src/ncc/Abstracts/ComponentFileExtensions.php rename to src/ncc/Enums/ComponentFileExtensions.php index 5d11e4c..355676c 100644 --- a/src/ncc/Abstracts/ComponentFileExtensions.php +++ b/src/ncc/Enums/ComponentFileExtensions.php @@ -20,14 +20,14 @@ * */ -namespace ncc\Abstracts; + namespace ncc\Enums; - abstract class ComponentFileExtensions + final class ComponentFileExtensions { /** * The file extensions that the PHP compiler extension will accept as components. * * @var array */ - const Php = ['*.php', '*.php3', '*.php4', '*.php5', '*.phtml']; + public const PHP = ['*.php', '*.php3', '*.php4', '*.php5', '*.phtml']; } \ No newline at end of file diff --git a/src/ncc/Abstracts/ComposerPackageTypes.php b/src/ncc/Enums/ComposerPackageTypes.php similarity index 89% rename from src/ncc/Abstracts/ComposerPackageTypes.php rename to src/ncc/Enums/ComposerPackageTypes.php index 9362571..76731f6 100644 --- a/src/ncc/Abstracts/ComposerPackageTypes.php +++ b/src/ncc/Enums/ComposerPackageTypes.php @@ -20,14 +20,14 @@ * */ -namespace ncc\Abstracts; + namespace ncc\Enums; - abstract class ComposerPackageTypes + final class ComposerPackageTypes { /** * This is the default. It will copy the files to `vendor` */ - const Library = 'library'; + public const LIBRARY = 'library'; /** * This denotes a project rather than a library. For example @@ -37,7 +37,7 @@ namespace ncc\Abstracts; * to provide listings of projects to initialize when creating * a new workspace. */ - const Project = 'project'; + public const PROJECT = 'project'; /** * An empty package that contains requirements and will trigger @@ -45,11 +45,11 @@ namespace ncc\Abstracts; * anything to the filesystem. As such, it does not require a * a dist or source key to be installable */ - const MetaPackage = 'metapackage'; + public const METAPACKAGE = 'metapackage'; /** * A package of type `composer-plugin` may provide an installer * for other packages that have a custom type. */ - const ComposerPlugin = 'composer-plugin'; + public const COMPOSER_PLUGIN = 'composer-plugin'; } \ No newline at end of file diff --git a/src/ncc/Abstracts/ComposerStabilityTypes.php b/src/ncc/Enums/ComposerStabilityTypes.php similarity index 82% rename from src/ncc/Abstracts/ComposerStabilityTypes.php rename to src/ncc/Enums/ComposerStabilityTypes.php index f4f8dc3..61ee54f 100644 --- a/src/ncc/Abstracts/ComposerStabilityTypes.php +++ b/src/ncc/Enums/ComposerStabilityTypes.php @@ -20,17 +20,17 @@ * */ -namespace ncc\Abstracts; + namespace ncc\Enums; - abstract class ComposerStabilityTypes + final class ComposerStabilityTypes { - const Dev = 'dev'; + public const DEV = 'dev'; - const Alpha = 'alpha'; + public const ALPHA = 'alpha'; - const Beta = 'beta'; + public const BETA = 'beta'; - const RC = 'rc'; + public const RC = 'rc'; - const Stable ='stable'; + public const STABLE ='stable'; } \ No newline at end of file diff --git a/src/ncc/Abstracts/ConsoleColors.php b/src/ncc/Enums/ConsoleColors.php similarity index 60% rename from src/ncc/Abstracts/ConsoleColors.php rename to src/ncc/Enums/ConsoleColors.php index f21a650..a5a370f 100644 --- a/src/ncc/Abstracts/ConsoleColors.php +++ b/src/ncc/Enums/ConsoleColors.php @@ -20,41 +20,41 @@ * */ -namespace ncc\Abstracts; + namespace ncc\Enums; - abstract class ConsoleColors + final class ConsoleColors { - const Default = "\e[39m"; + public const DEFAULT = "\e[39m"; - const Black = "\e[30m"; + public const BLACK = "\e[30m"; - const Red = "\e[31m"; + public const RED = "\e[31m"; - const Green = "\e[32m"; + public const GREEN = "\e[32m"; - const Yellow = "\e[33m"; + public const YELLOW = "\e[33m"; - const Blue = "\e[34m"; + public const BLUE = "\e[34m"; - const Magenta = "\e[35m"; + public const MAGENTA = "\e[35m"; - const Cyan = "\e[36m"; + public const CYAN = "\e[36m"; - const LightGray = "\e[37m"; + public const LIGHT_GREY = "\e[37m"; - const DarkGrey = "\e[90m"; + public const DARK_GREY = "\e[90m"; - const LightRed = "\e[91m"; + public const LIGHT_RED = "\e[91m"; - const LightGreen = "\e[92m"; + public const LIGHT_GREEN = "\e[92m"; - const LightYellow = "\e[93m"; + public const LIGHT_YELLOW = "\e[93m"; - const LightBlue = "\e[94m"; + public const LIGHT_BLUE = "\e[94m"; - const LightMagenta = "\e[95m"; + public const LIGHT_MAGENTA = "\e[95m"; - const LightCyan = "\e[96m"; + public const LIGHT_CYAN = "\e[96m"; - const White = "\e[97m"; + public const WHITE = "\e[97m"; } \ No newline at end of file diff --git a/src/ncc/Abstracts/ConstantReferences.php b/src/ncc/Enums/ConstantReferences.php similarity index 81% rename from src/ncc/Abstracts/ConstantReferences.php rename to src/ncc/Enums/ConstantReferences.php index 8e804de..9d2d74e 100644 --- a/src/ncc/Abstracts/ConstantReferences.php +++ b/src/ncc/Enums/ConstantReferences.php @@ -20,17 +20,17 @@ * */ -namespace ncc\Abstracts; +namespace ncc\Enums; - abstract class ConstantReferences + final class ConstantReferences { - const Assembly = 'assembly'; + public const ASSEMBLY = 'assembly'; - const Build = 'build'; + public const BUILD = 'build'; - const DateTime = 'date_time'; + public const DATE_TIME = 'date_time'; - const Install = 'install'; + public const INSTALL = 'install'; - const Runtime = 'runtime'; + public const RUNTIME = 'runtime'; } \ No newline at end of file diff --git a/src/ncc/Abstracts/DefinedRemoteSourceType.php b/src/ncc/Enums/DefinedRemoteSourceType.php similarity index 89% rename from src/ncc/Abstracts/DefinedRemoteSourceType.php rename to src/ncc/Enums/DefinedRemoteSourceType.php index 39c3855..a95aeb8 100644 --- a/src/ncc/Abstracts/DefinedRemoteSourceType.php +++ b/src/ncc/Enums/DefinedRemoteSourceType.php @@ -20,9 +20,9 @@ * */ -namespace ncc\Abstracts; + namespace ncc\Enums; - abstract class DefinedRemoteSourceType + final class DefinedRemoteSourceType { /** * THe remote source is from gitlab or a custom gitlab instance @@ -33,7 +33,7 @@ namespace ncc\Abstracts; * * Will still use git to fetch the package from the gitlab instance */ - const Gitlab = 'gitlab'; + public const GITLAB = 'gitlab'; /** * The remote source is from GitHub @@ -44,10 +44,10 @@ namespace ncc\Abstracts; * * Will still use git to fetch the package from the GitHub instance */ - const Github = 'github'; + public const GITHUB = 'github'; - const All = [ - self::Gitlab, - self::Github + public const ALL = [ + self::GITLAB, + self::GITHUB ]; } \ No newline at end of file diff --git a/src/ncc/Abstracts/DependencySourceType.php b/src/ncc/Enums/DependencySourceType.php similarity index 89% rename from src/ncc/Abstracts/DependencySourceType.php rename to src/ncc/Enums/DependencySourceType.php index 0a34cec..ccfed6f 100644 --- a/src/ncc/Abstracts/DependencySourceType.php +++ b/src/ncc/Enums/DependencySourceType.php @@ -20,30 +20,30 @@ * */ -namespace ncc\Abstracts; +namespace ncc\Enums; - abstract class DependencySourceType + final class DependencySourceType { /** * The dependency pointer does not point to a package */ - const None = 'none'; + public const NONE = 'none'; /** * Indicates if the dependency is statically linked and the * reference points to the compiled package of the dependency */ - const StaticLinking = 'static'; + public const STATIC = 'static'; /** * Indicates if the pointer reference points to a remote source * to fetch the dependency from */ - const RemoteSource = 'remote'; + public const REMOTE = 'remote'; /** * Indicates if the pointer reference points to a relative file with the * filename format "{package_name}=={version}.ncc" to fetch the dependency from */ - const Local = 'local'; + public const LOCAL = 'local'; } \ No newline at end of file diff --git a/src/ncc/Abstracts/EncoderType.php b/src/ncc/Enums/EncoderType.php similarity index 92% rename from src/ncc/Abstracts/EncoderType.php rename to src/ncc/Enums/EncoderType.php index 9dcbd00..a9915bc 100644 --- a/src/ncc/Abstracts/EncoderType.php +++ b/src/ncc/Enums/EncoderType.php @@ -20,9 +20,9 @@ * */ -namespace ncc\Abstracts; + namespace ncc\Enums; - abstract class EncoderType + final class EncoderType { - const ZiProto = '3'; + public const ZI_PROTO = '3'; } \ No newline at end of file diff --git a/src/ncc/Enums/ExceptionCodes.php b/src/ncc/Enums/ExceptionCodes.php new file mode 100644 index 0000000..1240f5f --- /dev/null +++ b/src/ncc/Enums/ExceptionCodes.php @@ -0,0 +1,439 @@ +0|[1-9]\d*)\.(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)(?:-(?P(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/m'; + public const SEMANTIC_VERSIONING_2 = '/^(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)(?:-(?P(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/m'; - const UnixPath = '/^(((?:\.\/|\.\.\/|\/)?(?:\.?\w+\/)*)(\.?\w+\.?\w+))$/m'; + public const UNIX_PATH = '/^(((?:\.\/|\.\.\/|\/)?(?:\.?\w+\/)*)(\.?\w+\.?\w+))$/m'; - const WindowsPath = '/^(([%][^\/:*?<>""|]*[%])|([a-zA-Z][:])|(\\\\))((\\\\{1})|((\\\\{1})[^\\\\]([^\/:*?<>""|]*))+)$/m'; + public const WINDOWS_PATH = '/^(([%][^\/:*?<>""|]*[%])|([a-zA-Z][:])|(\\\\))((\\\\{1})|((\\\\{1})[^\\\\]([^\/:*?<>""|]*))+)$/m'; - const ConstantName = '/^([^\x00-\x7F]|[\w_\ \.\+\-]){2,64}$/'; + public const CONSTANT_NAME = '/^([^\x00-\x7F]|[\w_\ \.\+\-]){2,64}$/'; - const ExecutionPolicyName = '/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/m'; + public const EXECUTION_POLICY_NAME = '/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/m'; /** * @author */ - const RemotePackage = '/^(?[^\/\n]+)\/(?[^:=\n@]+)(?:=(?[^:@\n]+))?(?::(?[^@\n]+))?@(?.*)$/m'; + public const REMOTE_PACKAGE = '/^(?[^\/\n]+)\/(?[^:=\n@]+)(?:=(?[^:@\n]+))?(?::(?[^@\n]+))?@(?.*)$/m'; } \ No newline at end of file diff --git a/src/ncc/Abstracts/RemoteSourceType.php b/src/ncc/Enums/RemoteSourceType.php similarity index 84% rename from src/ncc/Abstracts/RemoteSourceType.php rename to src/ncc/Enums/RemoteSourceType.php index 4f34a99..062e04a 100644 --- a/src/ncc/Abstracts/RemoteSourceType.php +++ b/src/ncc/Enums/RemoteSourceType.php @@ -20,31 +20,31 @@ * */ -namespace ncc\Abstracts; +namespace ncc\Enums; - abstract class RemoteSourceType + final class RemoteSourceType { /** * A builtin source type is not defined by the user but handled by * an extension built into NCC */ - const Builtin = 'builtin'; + public const BUILTIN = 'builtin'; /** * A defined source type is defined by the user in the remote sources file * and handled by an extension designed by passing on the information of * the source to the extension */ - const Defined = 'defined'; + public const DEFINED = 'defined'; /** * Unsupported or invalid source type */ - const Unknown = 'unknown'; + public const UNKNOWN = 'unknown'; - const All = [ - self::Builtin, - self::Defined, - self::Unknown + public const All = [ + self::BUILTIN, + self::DEFINED, + self::UNKNOWN ]; } \ No newline at end of file diff --git a/src/ncc/Abstracts/Runners.php b/src/ncc/Enums/Runners.php similarity index 69% rename from src/ncc/Abstracts/Runners.php rename to src/ncc/Enums/Runners.php index 2ab55d2..ea2740f 100644 --- a/src/ncc/Abstracts/Runners.php +++ b/src/ncc/Enums/Runners.php @@ -20,32 +20,31 @@ * */ -namespace ncc\Abstracts; +namespace ncc\Enums; - abstract class Runners + final class Runners { - const php = 'php'; + public const PHP = 'php'; - const bash = 'bash'; + public const BASH = 'bash'; - const python = 'python'; + public const PYTHON = 'python'; - const python3 = 'python3'; + public const PYTHON_3 = 'python3'; - const python2 = 'python2'; + public const PYTHON_2 = 'python2'; - const perl = 'perl'; + public const PERL = 'perl'; - const lua = 'lua'; + public const LUA = 'lua'; - - const All = [ - self::php, - self::bash, - self::python, - self::python3, - self::python2, - self::perl, - self::lua + public const ALL = [ + self::PHP, + self::BASH, + self::PYTHON, + self::PYTHON_3, + self::PYTHON_2, + self::PERL, + self::LUA ]; } \ No newline at end of file diff --git a/src/ncc/Abstracts/Scopes.php b/src/ncc/Enums/Scopes.php similarity index 88% rename from src/ncc/Abstracts/Scopes.php rename to src/ncc/Enums/Scopes.php index 0bc41a0..e6463e0 100644 --- a/src/ncc/Abstracts/Scopes.php +++ b/src/ncc/Enums/Scopes.php @@ -20,13 +20,13 @@ * */ -namespace ncc\Abstracts; +namespace ncc\Enums; - abstract class Scopes + final class Scopes { - const Auto = 'AUTO'; + public const AUTO = 'AUTO'; - const User = 'USER'; + public const USER = 'USER'; - const System = 'SYSTEM'; + public const SYSTEM = 'SYSTEM'; } \ No newline at end of file diff --git a/src/ncc/Abstracts/SpecialConstants/AssemblyConstants.php b/src/ncc/Enums/SpecialConstants/AssemblyConstants.php similarity index 73% rename from src/ncc/Abstracts/SpecialConstants/AssemblyConstants.php rename to src/ncc/Enums/SpecialConstants/AssemblyConstants.php index 4329da6..820b4bc 100644 --- a/src/ncc/Abstracts/SpecialConstants/AssemblyConstants.php +++ b/src/ncc/Enums/SpecialConstants/AssemblyConstants.php @@ -20,52 +20,52 @@ * */ -namespace ncc\Abstracts\SpecialConstants; + namespace ncc\Enums\SpecialConstants; - abstract class AssemblyConstants + final class AssemblyConstants { /** * Assembly's Name Property */ - const AssemblyName = '%ASSEMBLY.NAME%'; + public const ASSEMBLY_NAME = '%ASSEMBLY.NAME%'; /** * Assembly's Package Property */ - const AssemblyPackage = '%ASSEMBLY.PACKAGE%'; + public const ASSEMBLY_PACKAGE = '%ASSEMBLY.PACKAGE%'; /** * Assembly's Description Property */ - const AssemblyDescription = '%ASSEMBLY.DESCRIPTION%'; + public const ASSEMBLY_DESCRIPTION = '%ASSEMBLY.DESCRIPTION%'; /** * Assembly's Company Property */ - const AssemblyCompany = '%ASSEMBLY.COMPANY%'; + public const ASSEMBLY_COMPANY = '%ASSEMBLY.COMPANY%'; /** * Assembly's Product Property */ - const AssemblyProduct = '%ASSEMBLY.PRODUCT%'; + public const ASSEMBLY_PRODUCT = '%ASSEMBLY.PRODUCT%'; /** * Assembly's Copyright Property */ - const AssemblyCopyright = '%ASSEMBLY.COPYRIGHT%'; + public const ASSEMBLY_COPYRIGHT = '%ASSEMBLY.COPYRIGHT%'; /** * Assembly's Trademark Property */ - const AssemblyTrademark = '%ASSEMBLY.TRADEMARK%'; + public const ASSEMBLY_TRADEMARK = '%ASSEMBLY.TRADEMARK%'; /** * Assembly's Version Property */ - const AssemblyVersion = '%ASSEMBLY.VERSION%'; + public const ASSEMBLY_VERSION = '%ASSEMBLY.VERSION%'; /** * Assembly's UUID property */ - const AssemblyUid = '%ASSEMBLY.UID%'; + public const ASSEMBLY_UID = '%ASSEMBLY.UID%'; } \ No newline at end of file diff --git a/src/ncc/Abstracts/SpecialConstants/BuildConstants.php b/src/ncc/Enums/SpecialConstants/BuildConstants.php similarity index 82% rename from src/ncc/Abstracts/SpecialConstants/BuildConstants.php rename to src/ncc/Enums/SpecialConstants/BuildConstants.php index 7663a15..39b1e2d 100644 --- a/src/ncc/Abstracts/SpecialConstants/BuildConstants.php +++ b/src/ncc/Enums/SpecialConstants/BuildConstants.php @@ -20,27 +20,27 @@ * */ -namespace ncc\Abstracts\SpecialConstants; + namespace ncc\Enums\SpecialConstants; - abstract class BuildConstants + final class BuildConstants { /** * The Unix Timestamp for when the package was compiled */ - const CompileTimestamp = '%COMPILE_TIMESTAMP%'; + public const COMPILE_TIMESTAMP = '%COMPILE_TIMESTAMP%'; /** * The version of NCC that was used to compile the package */ - const NccBuildVersion = '%NCC_BUILD_VERSION%'; + public const NCC_BUILD_VERSION = '%NCC_BUILD_VERSION%'; /** * NCC Build Flags exploded into spaces */ - const NccBuildFlags = '%NCC_BUILD_FLAGS%'; + public const NCC_BUILD_FLAGS = '%NCC_BUILD_FLAGS%'; /** * NCC Build Branch */ - const NccBuildBranch = '%NCC_BUILD_BRANCH%'; + public const NCC_BUILD_BRANCH = '%NCC_BUILD_BRANCH%'; } \ No newline at end of file diff --git a/src/ncc/Abstracts/SpecialConstants/DateTimeConstants.php b/src/ncc/Enums/SpecialConstants/DateTimeConstants.php similarity index 67% rename from src/ncc/Abstracts/SpecialConstants/DateTimeConstants.php rename to src/ncc/Enums/SpecialConstants/DateTimeConstants.php index 197a580..03d6010 100644 --- a/src/ncc/Abstracts/SpecialConstants/DateTimeConstants.php +++ b/src/ncc/Enums/SpecialConstants/DateTimeConstants.php @@ -20,51 +20,51 @@ * */ -namespace ncc\Abstracts\SpecialConstants; + namespace ncc\Enums\SpecialConstants; - abstract class DateTimeConstants + final class DateTimeConstants { // Day Format /** * Day of the month, 2 digits with leading zeros */ - const d = '%d%'; // 01 through 31 + public const d = '%d%'; // 01 through 31 /** * A textual representation of a day, three letters */ - const D = '%D%'; // Mon through Sun + public const D = '%D%'; // Mon through Sun /** * Day of the month without leading zeros */ - const j = '%j%'; // 1 through 31 + public const j = '%j%'; // 1 through 31 /** * A full textual representation of the day of the week */ - const l = '%l%'; // Sunday through Saturday + public const l = '%l%'; // Sunday through Saturday /** * ISO 8601 numeric representation of the day of the week */ - const N = '%N%'; // 1 (Monday) to 7 (Sunday) + public const N = '%N%'; // 1 (Monday) to 7 (Sunday) /** * English ordinal suffix for the day of the month, 2 characters */ - const S = '%S%'; // st, nd, rd, th + public const S = '%S%'; // st, nd, rd, th /** * Numeric representation of the day of the week */ - const w = '%w%'; // 0 (sunday) through 6 (Saturday) + public const w = '%w%'; // 0 (sunday) through 6 (Saturday) /** * The day of the year (starting from 0) */ - const z = '%z%'; // 0 through 365 + public const z = '%z%'; // 0 through 365 @@ -73,7 +73,7 @@ namespace ncc\Abstracts\SpecialConstants; /** * ISO 8601 week number of year, weeks starting on Monday */ - const W = '%W%'; // 42 (42nd week in year) + public const W = '%W%'; // 42 (42nd week in year) @@ -82,27 +82,27 @@ namespace ncc\Abstracts\SpecialConstants; /** * A full textual representation of a month, such as January or March */ - const F = '%F%'; // January through December + public const F = '%F%'; // January through December /** * Numeric representation of a month, with leading zeros */ - const m = '%m%'; // 01 through 12 + public const m = '%m%'; // 01 through 12 /** * A short textual representation of a month, three letters */ - const M = '%M%'; // Jan through Dec + public const M = '%M%'; // Jan through Dec /** * Numeric representation of a month, without leading zeros */ - const n = '%n%'; // 1 through 12 + public const n = '%n%'; // 1 through 12 /** * Number of days in the given month */ - const t = '%t%'; // 28 through 31 + public const t = '%t%'; // 28 through 31 @@ -110,73 +110,73 @@ namespace ncc\Abstracts\SpecialConstants; /** * Whether it's a leap year */ - const L = '%L%'; // 1 (leap year), 0 otherwise + public const L = '%L%'; // 1 (leap year), 0 otherwise /** * ISO 8601 week-numbering year. This has the same value as Y, * except that if the ISO week number (W) belongs to the previous * or next year, that year is used instead. */ - const o = '%o%'; // Same as Y, except that it use week number to decide which year it falls onto + public const o = '%o%'; // Same as Y, except that it use week number to decide which year it falls onto /** * A full numeric representation of a year, at least 4 digits, with - for years BCE. */ - const Y = '%Y%'; // 1991, 2012, 2014, ... + public const Y = '%Y%'; // 1991, 2012, 2014, ... /** * A two digit representation of a year */ - const y = '%y%'; // 91, 12, 14, ... + public const y = '%y%'; // 91, 12, 14, ... // Time Format /** * Lowercase Ante meridiem and Post meridiem */ - const a = '%a%'; // am or pm + public const a = '%a%'; // am or pm /** * Uppercase Ante meridiem and Post meridiem */ - const A = '%A%'; // AM or PM + public const A = '%A%'; // AM or PM /** * Swatch Internet time */ - const B = '%B%'; // 000 through 999 + public const B = '%B%'; // 000 through 999 /** * 12-hour format of an hour without leading zeros */ - const g = '%g%'; // 1 through 12 + public const g = '%g%'; // 1 through 12 /** * 24-hour format of an hour without leading zeros */ - const G = '%G%'; // 0 through 23 + public const G = '%G%'; // 0 through 23 /** * 12-hour format of an hour with leading zeros */ - const h = '%h%'; // 01 through 12 + public const h = '%h%'; // 01 through 12 /** * 24-hour format of an hour with leading zeros */ - const H = '%H%'; // 01 through 23 + public const H = '%H%'; // 01 through 23 /** * Minutes with leading zeros */ - const i = '%i%'; // 01 through 59 + public const i = '%i%'; // 01 through 59 /** * Seconds with leading zeros */ - const s = '%s%'; // 00 through 59 + public const s = '%s%'; // 00 through 59 // DateTime format - const c = '%c%'; // 2004-02-12T15:19:21 - const r = '%r%'; // Thu, 21 Dec 2000 16:01:07 - const u = '%u%'; // Unix Timestamp (seconds since Jan 1 1970 00:00:00) + public const c = '%c%'; // 2004-02-12T15:19:21 + public const r = '%r%'; // Thu, 21 Dec 2000 16:01:07 + public const u = '%u%'; // Unix Timestamp (seconds since Jan 1 1970 00:00:00) } \ No newline at end of file diff --git a/src/ncc/Abstracts/SpecialConstants/InstallConstants.php b/src/ncc/Enums/SpecialConstants/InstallConstants.php similarity index 78% rename from src/ncc/Abstracts/SpecialConstants/InstallConstants.php rename to src/ncc/Enums/SpecialConstants/InstallConstants.php index e4fb4ec..ab7636b 100644 --- a/src/ncc/Abstracts/SpecialConstants/InstallConstants.php +++ b/src/ncc/Enums/SpecialConstants/InstallConstants.php @@ -20,15 +20,15 @@ * */ -namespace ncc\Abstracts\SpecialConstants; +namespace ncc\Enums\SpecialConstants; - abstract class InstallConstants + final class InstallConstants { - const InstallationPath = '%INSTALL_PATH%'; + public const INSTALL_PATH = '%INSTALL_PATH%'; - const BinPath = '%INSTALL_PATH.BIN%'; + public const INSTALL_PATH_BIN = '%INSTALL_PATH.BIN%'; - const SourcePath = '%INSTALL_PATH.SRC%'; + public const INSTALL_PATH_SRC = '%INSTALL_PATH.SRC%'; - const DataPath = '%INSTALL_PATH.DATA%'; + public const INSTALL_PATH_DATA = '%INSTALL_PATH.DATA%'; } \ No newline at end of file diff --git a/src/ncc/Abstracts/SpecialConstants/RuntimeConstants.php b/src/ncc/Enums/SpecialConstants/RuntimeConstants.php similarity index 81% rename from src/ncc/Abstracts/SpecialConstants/RuntimeConstants.php rename to src/ncc/Enums/SpecialConstants/RuntimeConstants.php index fd7444e..f96785f 100644 --- a/src/ncc/Abstracts/SpecialConstants/RuntimeConstants.php +++ b/src/ncc/Enums/SpecialConstants/RuntimeConstants.php @@ -20,14 +20,13 @@ * */ -namespace ncc\Abstracts\SpecialConstants; + namespace ncc\Enums\SpecialConstants; - abstract class RuntimeConstants + final class RuntimeConstants { - const CWD = '%CWD%'; - - const PID = '%PID%'; - const UID = '%UID%'; - const GID = '%GID%'; - const User = '%USER%'; + public const CWD = '%CWD%'; + public const PID = '%PID%'; + public const UID = '%UID%'; + public const GID = '%GID%'; + public const USER = '%USER%'; } \ No newline at end of file diff --git a/src/ncc/Abstracts/Versions.php b/src/ncc/Enums/Versions.php similarity index 85% rename from src/ncc/Abstracts/Versions.php rename to src/ncc/Enums/Versions.php index f6fab41..f1f0734 100644 --- a/src/ncc/Abstracts/Versions.php +++ b/src/ncc/Enums/Versions.php @@ -20,27 +20,27 @@ * */ -namespace ncc\Abstracts; + namespace ncc\Enums; - abstract class Versions + final class Versions { /** * The current version of the credentials store file format */ - const CredentialsStoreVersion = '1.0.0'; + public const CREDENTIALS_STORE_VERSION = '1.0.0'; /** * The current version of the package structure file format */ - const PackageStructureVersion = '1.0'; + public const PACKAGE_STRUCTURE_VERSION = '1.0'; /** * The current version of the package lock structure file format */ - const PackageLockVersion = '1.0.0'; + public const PACKAGE_LOCK_VERSION = '1.0.0'; /** * Generic version of the package structure file format (latest) */ - const Latest = 'latest'; + public const LATEST = 'latest'; } \ No newline at end of file diff --git a/src/ncc/Exceptions/AccessDeniedException.php b/src/ncc/Exceptions/AccessDeniedException.php index f1af713..b809199 100644 --- a/src/ncc/Exceptions/AccessDeniedException.php +++ b/src/ncc/Exceptions/AccessDeniedException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class AccessDeniedException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::AccessDeniedException, $previous); + parent::__construct($message, ExceptionCodes::ACCESS_DENIED, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/ArchiveException.php b/src/ncc/Exceptions/ArchiveException.php index 052bf1b..c6e84dd 100644 --- a/src/ncc/Exceptions/ArchiveException.php +++ b/src/ncc/Exceptions/ArchiveException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class ArchiveException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::ArchiveException, $previous); + parent::__construct($message, ExceptionCodes::ARCHIVE_EXCEPTION, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/AuthenticationException.php b/src/ncc/Exceptions/AuthenticationException.php index 35ea66d..5db4daa 100644 --- a/src/ncc/Exceptions/AuthenticationException.php +++ b/src/ncc/Exceptions/AuthenticationException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class AuthenticationException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::AuthenticationException, $previous); + parent::__construct($message, ExceptionCodes::AUTHENTICATION_EXCEPTION, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/AutoloadGeneratorException.php b/src/ncc/Exceptions/AutoloadGeneratorException.php index b3d92ed..e33fabc 100644 --- a/src/ncc/Exceptions/AutoloadGeneratorException.php +++ b/src/ncc/Exceptions/AutoloadGeneratorException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class AutoloadGeneratorException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::AutoloadGeneratorException, $previous); + parent::__construct($message, ExceptionCodes::AUTOLOAD_GENERATOR, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/BuildConfigurationNotFoundException.php b/src/ncc/Exceptions/BuildConfigurationNotFoundException.php index cff197b..b3d636b 100644 --- a/src/ncc/Exceptions/BuildConfigurationNotFoundException.php +++ b/src/ncc/Exceptions/BuildConfigurationNotFoundException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class BuildConfigurationNotFoundException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::BuildConfigurationNotFoundException, $previous); + parent::__construct($message, ExceptionCodes::BUILD_CONFIGURATION_NOT_FOUND, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/BuildException.php b/src/ncc/Exceptions/BuildException.php index 4394f96..4e88a09 100644 --- a/src/ncc/Exceptions/BuildException.php +++ b/src/ncc/Exceptions/BuildException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class BuildException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::BuildException, $previous); + parent::__construct($message, ExceptionCodes::BUILD_EXCEPTION, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/ComponentChecksumException.php b/src/ncc/Exceptions/ComponentChecksumException.php index 9261aa7..83eb02b 100644 --- a/src/ncc/Exceptions/ComponentChecksumException.php +++ b/src/ncc/Exceptions/ComponentChecksumException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class ComponentChecksumException extends Exception @@ -35,6 +35,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::ComponentChecksumException, $previous); + parent::__construct($message, ExceptionCodes::COMPONENT_CHECKSUM_EXCEPTION, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/ComponentDecodeException.php b/src/ncc/Exceptions/ComponentDecodeException.php index 6d08524..25ca491 100644 --- a/src/ncc/Exceptions/ComponentDecodeException.php +++ b/src/ncc/Exceptions/ComponentDecodeException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class ComponentDecodeException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::ComponentDecodeException, $previous); + parent::__construct($message, ExceptionCodes::COMPONENT_DECODE_EXCEPTION, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/ComponentVersionNotFoundException.php b/src/ncc/Exceptions/ComponentVersionNotFoundException.php index 8edbc99..f883f2d 100644 --- a/src/ncc/Exceptions/ComponentVersionNotFoundException.php +++ b/src/ncc/Exceptions/ComponentVersionNotFoundException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class ComponentVersionNotFoundException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::ComponentVersionNotFoundException, $previous); + parent::__construct($message, ExceptionCodes::COMPONENT_VERSION_NOT_FOUND, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/ComposerDisabledException.php b/src/ncc/Exceptions/ComposerDisabledException.php index 5ecbf63..38ca7d7 100644 --- a/src/ncc/Exceptions/ComposerDisabledException.php +++ b/src/ncc/Exceptions/ComposerDisabledException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class ComposerDisabledException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::ComposerDisabledException, $previous); + parent::__construct($message, ExceptionCodes::COMPOSER_DISABLED_EXCEPTION, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/ComposerException.php b/src/ncc/Exceptions/ComposerException.php index 52bc4b7..d279686 100644 --- a/src/ncc/Exceptions/ComposerException.php +++ b/src/ncc/Exceptions/ComposerException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class ComposerException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::ComposerException, $previous); + parent::__construct($message, ExceptionCodes::COMPOSER_EXCEPTION, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/ComposerNotAvailableException.php b/src/ncc/Exceptions/ComposerNotAvailableException.php index 2f99a51..57a9c73 100644 --- a/src/ncc/Exceptions/ComposerNotAvailableException.php +++ b/src/ncc/Exceptions/ComposerNotAvailableException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; class ComposerNotAvailableException extends Exception { @@ -33,6 +33,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", $previous = null) { - parent::__construct($message, ExceptionCodes::ComposerNotAvailableException, $previous); + parent::__construct($message, ExceptionCodes::COMPOSER_NOT_AVAILABLE, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/ConstantReadonlyException.php b/src/ncc/Exceptions/ConstantReadonlyException.php index 9ccbeef..8d9798d 100644 --- a/src/ncc/Exceptions/ConstantReadonlyException.php +++ b/src/ncc/Exceptions/ConstantReadonlyException.php @@ -24,7 +24,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class ConstantReadonlyException extends Exception diff --git a/src/ncc/Exceptions/DirectoryNotFoundException.php b/src/ncc/Exceptions/DirectoryNotFoundException.php index 7667292..a834296 100644 --- a/src/ncc/Exceptions/DirectoryNotFoundException.php +++ b/src/ncc/Exceptions/DirectoryNotFoundException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class DirectoryNotFoundException extends Exception @@ -36,6 +36,6 @@ namespace ncc\Exceptions; */ public function __construct(string $path = "", ?Throwable $previous = null) { - parent::__construct('The file \'' . realpath($path) . '\' was not found', ExceptionCodes::DirectoryNotFoundException, $previous); + parent::__construct('The file \'' . realpath($path) . '\' was not found', ExceptionCodes::DIRECTORY_NOT_FOUND, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/FileNotFoundException.php b/src/ncc/Exceptions/FileNotFoundException.php index 198365e..6ae587e 100644 --- a/src/ncc/Exceptions/FileNotFoundException.php +++ b/src/ncc/Exceptions/FileNotFoundException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; /** @@ -38,6 +38,6 @@ namespace ncc\Exceptions; */ public function __construct(string $path = "", ?Throwable $previous = null) { - parent::__construct('The file \'' . realpath($path) . '\' was not found', ExceptionCodes::FileNotFoundException, $previous); + parent::__construct('The file \'' . realpath($path) . '\' was not found', ExceptionCodes::FILE_NOT_FOUND, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/GitCheckoutException.php b/src/ncc/Exceptions/GitCheckoutException.php index aaad3c4..04aa4f3 100644 --- a/src/ncc/Exceptions/GitCheckoutException.php +++ b/src/ncc/Exceptions/GitCheckoutException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class GitCheckoutException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::GitCheckoutException, $previous); + parent::__construct($message, ExceptionCodes::GIT_CHECKOUT_EXCEPTION, $previous); } } diff --git a/src/ncc/Exceptions/GitCloneException.php b/src/ncc/Exceptions/GitCloneException.php index 1dd4aac..140d8f2 100644 --- a/src/ncc/Exceptions/GitCloneException.php +++ b/src/ncc/Exceptions/GitCloneException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class GitCloneException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::GitCloneException, $previous); + parent::__construct($message, ExceptionCodes::GIT_CLONE_EXCEPTION, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/GitTagsException.php b/src/ncc/Exceptions/GitTagsException.php index 4045b53..1fa5dc1 100644 --- a/src/ncc/Exceptions/GitTagsException.php +++ b/src/ncc/Exceptions/GitTagsException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class GitTagsException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::GitTagsException, $previous); + parent::__construct($message, ExceptionCodes::GIT_TAGS_EXCEPTION, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/GithubServiceException.php b/src/ncc/Exceptions/GithubServiceException.php index b907b29..13a4ba5 100644 --- a/src/ncc/Exceptions/GithubServiceException.php +++ b/src/ncc/Exceptions/GithubServiceException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class GithubServiceException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::GithubServiceException, $previous); + parent::__construct($message, ExceptionCodes::GITHUB_SERVICE_EXCEPTION, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/GitlabServiceException.php b/src/ncc/Exceptions/GitlabServiceException.php index 859025b..f4c8398 100644 --- a/src/ncc/Exceptions/GitlabServiceException.php +++ b/src/ncc/Exceptions/GitlabServiceException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class GitlabServiceException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::GitlabServiceException, $previous); + parent::__construct($message, ExceptionCodes::GITLAB_SERVICE_EXCEPTION, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/HttpException.php b/src/ncc/Exceptions/HttpException.php index a9dcd9a..821ced1 100644 --- a/src/ncc/Exceptions/HttpException.php +++ b/src/ncc/Exceptions/HttpException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class HttpException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::HttpException, $previous); + parent::__construct($message, ExceptionCodes::HTTP_EXCEPTION, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/IOException.php b/src/ncc/Exceptions/IOException.php index 51d8c98..2e08b2d 100644 --- a/src/ncc/Exceptions/IOException.php +++ b/src/ncc/Exceptions/IOException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class IOException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::IOException, $previous); + parent::__construct($message, ExceptionCodes::IO_EXCEPTION, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/ImportException.php b/src/ncc/Exceptions/ImportException.php index 3e99de3..9a10fb0 100644 --- a/src/ncc/Exceptions/ImportException.php +++ b/src/ncc/Exceptions/ImportException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class ImportException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::ImportException, $previous); + parent::__construct($message, ExceptionCodes::IMPORT_EXCEPTION, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/InstallationException.php b/src/ncc/Exceptions/InstallationException.php index de66444..4a1320a 100644 --- a/src/ncc/Exceptions/InstallationException.php +++ b/src/ncc/Exceptions/InstallationException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class InstallationException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::InstallationException, $previous); + parent::__construct($message, ExceptionCodes::INSTALLATION_EXCEPTION, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/InternalComposerNotAvailableException.php b/src/ncc/Exceptions/InternalComposerNotAvailableException.php index 1d4808c..d074798 100644 --- a/src/ncc/Exceptions/InternalComposerNotAvailableException.php +++ b/src/ncc/Exceptions/InternalComposerNotAvailableException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class InternalComposerNotAvailableException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::InternalComposerNotAvailable, $previous); + parent::__construct($message, ExceptionCodes::INTERNAL_COMPOSER_NOT_AVAILABLE, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/InvalidBuildConfigurationException.php b/src/ncc/Exceptions/InvalidBuildConfigurationException.php index 80cb3cc..fad506f 100644 --- a/src/ncc/Exceptions/InvalidBuildConfigurationException.php +++ b/src/ncc/Exceptions/InvalidBuildConfigurationException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class InvalidBuildConfigurationException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::InvalidBuildConfigurationException, $previous); + parent::__construct($message, ExceptionCodes::INVALID_BUILD_CONFIGURATION, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/InvalidConstantNameException.php b/src/ncc/Exceptions/InvalidConstantNameException.php index 836848b..7fdc13f 100644 --- a/src/ncc/Exceptions/InvalidConstantNameException.php +++ b/src/ncc/Exceptions/InvalidConstantNameException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class InvalidConstantNameException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::InvalidConstantNameException, $previous); + parent::__construct($message, ExceptionCodes::INVALID_CONSTANT_NAME, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/InvalidCredentialsEntryException.php b/src/ncc/Exceptions/InvalidCredentialsEntryException.php index 5b0d6db..9f9b217 100644 --- a/src/ncc/Exceptions/InvalidCredentialsEntryException.php +++ b/src/ncc/Exceptions/InvalidCredentialsEntryException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class InvalidCredentialsEntryException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::InvalidCredentialsEntryException, $previous); + parent::__construct($message, ExceptionCodes::INVALID_CREDENTIALS_ENTRY, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/InvalidDependencyConfiguration.php b/src/ncc/Exceptions/InvalidDependencyConfiguration.php index 5fd2b75..6b1ed24 100644 --- a/src/ncc/Exceptions/InvalidDependencyConfiguration.php +++ b/src/ncc/Exceptions/InvalidDependencyConfiguration.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class InvalidDependencyConfiguration extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::InvalidDependencyConfiguration, $previous); + parent::__construct($message, ExceptionCodes::INVALID_DEPENDENCY_CONFIGURATION, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/InvalidExecutionPolicyName.php b/src/ncc/Exceptions/InvalidExecutionPolicyName.php index 5fa3e61..b52fca3 100644 --- a/src/ncc/Exceptions/InvalidExecutionPolicyName.php +++ b/src/ncc/Exceptions/InvalidExecutionPolicyName.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class InvalidExecutionPolicyName extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::InvalidExecutionPolicyName, $previous); + parent::__construct($message, ExceptionCodes::INVALID_EXECUTION_POLICY_NAME, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/InvalidPackageException.php b/src/ncc/Exceptions/InvalidPackageException.php index 5af8de4..56f4318 100644 --- a/src/ncc/Exceptions/InvalidPackageException.php +++ b/src/ncc/Exceptions/InvalidPackageException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class InvalidPackageException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::InvalidPackageException, $previous); + parent::__construct($message, ExceptionCodes::INVALID_PACKAGE, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/InvalidPackageNameException.php b/src/ncc/Exceptions/InvalidPackageNameException.php index fbaeb18..7aa9d38 100644 --- a/src/ncc/Exceptions/InvalidPackageNameException.php +++ b/src/ncc/Exceptions/InvalidPackageNameException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class InvalidPackageNameException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::InvalidPackageNameException, $previous); + parent::__construct($message, ExceptionCodes::INVALID_PACKAGE_NAME, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/InvalidProjectBuildConfiguration.php b/src/ncc/Exceptions/InvalidProjectBuildConfiguration.php index b5ec73a..89d62c0 100644 --- a/src/ncc/Exceptions/InvalidProjectBuildConfiguration.php +++ b/src/ncc/Exceptions/InvalidProjectBuildConfiguration.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class InvalidProjectBuildConfiguration extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::InvalidProjectBuildConfiguration, $previous); + parent::__construct($message, ExceptionCodes::INVALID_PROJECT_BUILD_CONFIGURATION, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/InvalidProjectConfigurationException.php b/src/ncc/Exceptions/InvalidProjectConfigurationException.php index a8ec2bf..b5a9f6b 100644 --- a/src/ncc/Exceptions/InvalidProjectConfigurationException.php +++ b/src/ncc/Exceptions/InvalidProjectConfigurationException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; /** @@ -44,7 +44,7 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?string $property=null, ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::InvalidProjectConfigurationException, $previous); + parent::__construct($message, ExceptionCodes::INVALID_PROJECT_CONFIGURATION, $previous); $this->property = $property; } diff --git a/src/ncc/Exceptions/InvalidProjectNameException.php b/src/ncc/Exceptions/InvalidProjectNameException.php index bf3adff..e6c0718 100644 --- a/src/ncc/Exceptions/InvalidProjectNameException.php +++ b/src/ncc/Exceptions/InvalidProjectNameException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class InvalidProjectNameException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::InvalidProjectNameException, $previous); + parent::__construct($message, ExceptionCodes::INVALID_PROJECT_NAME, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/InvalidPropertyValueException.php b/src/ncc/Exceptions/InvalidPropertyValueException.php index 904c806..d12f06e 100644 --- a/src/ncc/Exceptions/InvalidPropertyValueException.php +++ b/src/ncc/Exceptions/InvalidPropertyValueException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class InvalidPropertyValueException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::InvalidPropertyValueException, $previous); + parent::__construct($message, ExceptionCodes::INVALID_PROPERTY_VALUE, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/InvalidScopeException.php b/src/ncc/Exceptions/InvalidScopeException.php index 67fbebe..1b815b7 100644 --- a/src/ncc/Exceptions/InvalidScopeException.php +++ b/src/ncc/Exceptions/InvalidScopeException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class InvalidScopeException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $scope = "", ?Throwable $previous = null) { - parent::__construct('The given scope \'' . $scope . '\' is not valid', ExceptionCodes::InvalidScopeException, $previous); + parent::__construct('The given scope \'' . $scope . '\' is not valid', ExceptionCodes::INVALID_SCOPE, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/InvalidVersionConfigurationException.php b/src/ncc/Exceptions/InvalidVersionConfigurationException.php index 373646a..63cd07a 100644 --- a/src/ncc/Exceptions/InvalidVersionConfigurationException.php +++ b/src/ncc/Exceptions/InvalidVersionConfigurationException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class InvalidVersionConfigurationException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::InvalidVersionConfigurationException, $previous); + parent::__construct($message, ExceptionCodes::INVALID_VERSION_CONFIGURATION, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/InvalidVersionNumberException.php b/src/ncc/Exceptions/InvalidVersionNumberException.php index 23b1e8f..8fb9816 100644 --- a/src/ncc/Exceptions/InvalidVersionNumberException.php +++ b/src/ncc/Exceptions/InvalidVersionNumberException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class InvalidVersionNumberException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::InvalidVersionNumberException, $previous); + parent::__construct($message, ExceptionCodes::INVALID_VERSION_NUMBER, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/MalformedJsonException.php b/src/ncc/Exceptions/MalformedJsonException.php index c4bdec5..c4d0075 100644 --- a/src/ncc/Exceptions/MalformedJsonException.php +++ b/src/ncc/Exceptions/MalformedJsonException.php @@ -24,7 +24,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class MalformedJsonException extends Exception @@ -35,6 +35,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::MalformedJsonException, $previous); + parent::__construct($message, ExceptionCodes::MALFORMED_JSON, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/MissingDependencyException.php b/src/ncc/Exceptions/MissingDependencyException.php index 62cdf44..2a5ca7c 100644 --- a/src/ncc/Exceptions/MissingDependencyException.php +++ b/src/ncc/Exceptions/MissingDependencyException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class MissingDependencyException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::MissingDependencyException, $previous); + parent::__construct($message, ExceptionCodes::MISSING_DEPENDENCY, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/NoAvailableUnitsException.php b/src/ncc/Exceptions/NoAvailableUnitsException.php index eb7f325..fc72e91 100644 --- a/src/ncc/Exceptions/NoAvailableUnitsException.php +++ b/src/ncc/Exceptions/NoAvailableUnitsException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class NoAvailableUnitsException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::NoAvailableUnitsException, $previous); + parent::__construct($message, ExceptionCodes::NO_AVAILABLE_UNITS, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/NoUnitsFoundException.php b/src/ncc/Exceptions/NoUnitsFoundException.php index 48423b7..b752e6f 100644 --- a/src/ncc/Exceptions/NoUnitsFoundException.php +++ b/src/ncc/Exceptions/NoUnitsFoundException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class NoUnitsFoundException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::NoUnitsFoundException, $previous); + parent::__construct($message, ExceptionCodes::NO_UNITS_FOUND, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/NotImplementedException.php b/src/ncc/Exceptions/NotImplementedException.php index 55de1d1..98fd286 100644 --- a/src/ncc/Exceptions/NotImplementedException.php +++ b/src/ncc/Exceptions/NotImplementedException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class NotImplementedException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::NotImplementedException, $previous); + parent::__construct($message, ExceptionCodes::NOT_IMPLEMENTED, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/NotSupportedException.php b/src/ncc/Exceptions/NotSupportedException.php index a629e67..7d6a7c7 100644 --- a/src/ncc/Exceptions/NotSupportedException.php +++ b/src/ncc/Exceptions/NotSupportedException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class NotSupportedException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::NotSupportedException, $previous); + parent::__construct($message, ExceptionCodes::NOT_SUPPORTED_EXCEPTION, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/PackageAlreadyInstalledException.php b/src/ncc/Exceptions/PackageAlreadyInstalledException.php index fcbd34c..a06d70d 100644 --- a/src/ncc/Exceptions/PackageAlreadyInstalledException.php +++ b/src/ncc/Exceptions/PackageAlreadyInstalledException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class PackageAlreadyInstalledException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::PackageAlreadyInstalledException, $previous); + parent::__construct($message, ExceptionCodes::PACKAGE_ALREADY_INSTALLED, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/PackageFetchException.php b/src/ncc/Exceptions/PackageFetchException.php index 4dbbbed..7ae2cb8 100644 --- a/src/ncc/Exceptions/PackageFetchException.php +++ b/src/ncc/Exceptions/PackageFetchException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class PackageFetchException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::PackageFetchException, $previous); + parent::__construct($message, ExceptionCodes::PACKAGE_FETCH_EXCEPTION, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/PackageLockException.php b/src/ncc/Exceptions/PackageLockException.php index 58bbced..0901775 100644 --- a/src/ncc/Exceptions/PackageLockException.php +++ b/src/ncc/Exceptions/PackageLockException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class PackageLockException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::PackageLockException, $previous); + parent::__construct($message, ExceptionCodes::PACKAGE_LOCK_EXCEPTION, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/PackageNotFoundException.php b/src/ncc/Exceptions/PackageNotFoundException.php index 070d601..08eb9d6 100644 --- a/src/ncc/Exceptions/PackageNotFoundException.php +++ b/src/ncc/Exceptions/PackageNotFoundException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class PackageNotFoundException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::PackageNotFoundException, $previous); + parent::__construct($message, ExceptionCodes::PACKAGE_NOT_FOUND, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/PackageParsingException.php b/src/ncc/Exceptions/PackageParsingException.php index 7106d1a..fa85b81 100644 --- a/src/ncc/Exceptions/PackageParsingException.php +++ b/src/ncc/Exceptions/PackageParsingException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class PackageParsingException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::PackageParsingException, $previous); + parent::__construct($message, ExceptionCodes::PACKAGE_PARSING_EXCEPTION, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/PackagePreparationFailedException.php b/src/ncc/Exceptions/PackagePreparationFailedException.php index 223795f..1ee7fd8 100644 --- a/src/ncc/Exceptions/PackagePreparationFailedException.php +++ b/src/ncc/Exceptions/PackagePreparationFailedException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class PackagePreparationFailedException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::PackagePreparationFailedException, $previous); + parent::__construct($message, ExceptionCodes::PACKAGE_PREPARATION_FAILED, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/ProjectAlreadyExistsException.php b/src/ncc/Exceptions/ProjectAlreadyExistsException.php index 3354002..10fdd63 100644 --- a/src/ncc/Exceptions/ProjectAlreadyExistsException.php +++ b/src/ncc/Exceptions/ProjectAlreadyExistsException.php @@ -24,7 +24,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class ProjectAlreadyExistsException extends Exception @@ -35,6 +35,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::ProjectAlreadyExistsException, $previous); + parent::__construct($message, ExceptionCodes::PROJECT_ALREADY_EXISTS, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/ProjectConfigurationNotFoundException.php b/src/ncc/Exceptions/ProjectConfigurationNotFoundException.php index 37e4e90..c69986e 100644 --- a/src/ncc/Exceptions/ProjectConfigurationNotFoundException.php +++ b/src/ncc/Exceptions/ProjectConfigurationNotFoundException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class ProjectConfigurationNotFoundException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::ProjectConfigurationNotFoundException, $previous); + parent::__construct($message, ExceptionCodes::PROJECT_CONFIGURATION_NOT_FOUND, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/RunnerExecutionException.php b/src/ncc/Exceptions/RunnerExecutionException.php index 244a0b5..9b1f42b 100644 --- a/src/ncc/Exceptions/RunnerExecutionException.php +++ b/src/ncc/Exceptions/RunnerExecutionException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class RunnerExecutionException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::RunnerExecutionException, $previous); + parent::__construct($message, ExceptionCodes::RUNNER_EXECUTION_EXCEPTION, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/RuntimeException.php b/src/ncc/Exceptions/RuntimeException.php index feb0953..e38a139 100644 --- a/src/ncc/Exceptions/RuntimeException.php +++ b/src/ncc/Exceptions/RuntimeException.php @@ -24,7 +24,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class RuntimeException extends Exception @@ -35,6 +35,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::RuntimeException, $previous); + parent::__construct($message, ExceptionCodes::RUNTIME, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/SymlinkException.php b/src/ncc/Exceptions/SymlinkException.php index 4675f4c..d6740ed 100644 --- a/src/ncc/Exceptions/SymlinkException.php +++ b/src/ncc/Exceptions/SymlinkException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class SymlinkException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::SymlinkException, $previous); + parent::__construct($message, ExceptionCodes::SYMLINK_EXCEPTION, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/UndefinedExecutionPolicyException.php b/src/ncc/Exceptions/UndefinedExecutionPolicyException.php index 34e8096..324271d 100644 --- a/src/ncc/Exceptions/UndefinedExecutionPolicyException.php +++ b/src/ncc/Exceptions/UndefinedExecutionPolicyException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class UndefinedExecutionPolicyException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::UndefinedExecutionPolicyException, $previous); + parent::__construct($message, ExceptionCodes::UNDEFINED_EXECUTION_POLICY, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/UnsupportedArchiveException.php b/src/ncc/Exceptions/UnsupportedArchiveException.php index 4a7bf33..cff1c6d 100644 --- a/src/ncc/Exceptions/UnsupportedArchiveException.php +++ b/src/ncc/Exceptions/UnsupportedArchiveException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class UnsupportedArchiveException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::UnsupportedArchiveException, $previous); + parent::__construct($message, ExceptionCodes::UNSUPPORTED_ARCHIVE, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/UnsupportedCompilerExtensionException.php b/src/ncc/Exceptions/UnsupportedCompilerExtensionException.php index d2ffdd4..51d14ce 100644 --- a/src/ncc/Exceptions/UnsupportedCompilerExtensionException.php +++ b/src/ncc/Exceptions/UnsupportedCompilerExtensionException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class UnsupportedCompilerExtensionException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::UnsupportedCompilerExtensionException, $previous); + parent::__construct($message, ExceptionCodes::UNSUPPORTED_COMPILER_EXTENSION, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/UnsupportedComponentTypeException.php b/src/ncc/Exceptions/UnsupportedComponentTypeException.php index 5352a41..76cdc54 100644 --- a/src/ncc/Exceptions/UnsupportedComponentTypeException.php +++ b/src/ncc/Exceptions/UnsupportedComponentTypeException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class UnsupportedComponentTypeException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::UnsupportedComponentTypeException, $previous); + parent::__construct($message, ExceptionCodes::UNSUPPORTED_COMPONENT_TYPE, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/UnsupportedExtensionVersionException.php b/src/ncc/Exceptions/UnsupportedExtensionVersionException.php index 4084580..b7f4550 100644 --- a/src/ncc/Exceptions/UnsupportedExtensionVersionException.php +++ b/src/ncc/Exceptions/UnsupportedExtensionVersionException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class UnsupportedExtensionVersionException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::UnsupportedExtensionVersionException, $previous); + parent::__construct($message, ExceptionCodes::UNSUPPORTED_EXTENSION_VERSION, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/UnsupportedPackageException.php b/src/ncc/Exceptions/UnsupportedPackageException.php index 6e08431..8991ee5 100644 --- a/src/ncc/Exceptions/UnsupportedPackageException.php +++ b/src/ncc/Exceptions/UnsupportedPackageException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class UnsupportedPackageException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::UnsupportedPackageException, $previous); + parent::__construct($message, ExceptionCodes::UNSUPPORTED_PACKAGE, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/UnsupportedProjectTypeException.php b/src/ncc/Exceptions/UnsupportedProjectTypeException.php index 6cb7904..c7be8e2 100644 --- a/src/ncc/Exceptions/UnsupportedProjectTypeException.php +++ b/src/ncc/Exceptions/UnsupportedProjectTypeException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class UnsupportedProjectTypeException extends Exception @@ -35,6 +35,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::UnsupportedProjectTypeException, $previous); + parent::__construct($message, ExceptionCodes::UNSUPPORTED_PROJECT_TYPE, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/UnsupportedRemoteSourceTypeException.php b/src/ncc/Exceptions/UnsupportedRemoteSourceTypeException.php index a8bf044..51754df 100644 --- a/src/ncc/Exceptions/UnsupportedRemoteSourceTypeException.php +++ b/src/ncc/Exceptions/UnsupportedRemoteSourceTypeException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class UnsupportedRemoteSourceTypeException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::UnsupportedRemoteSourceTypeException, $previous); + parent::__construct($message, ExceptionCodes::UNSUPPORTED_REMOTE_SOURCE_TYPE, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/UserAbortedOperationException.php b/src/ncc/Exceptions/UserAbortedOperationException.php index fa27d21..235379e 100644 --- a/src/ncc/Exceptions/UserAbortedOperationException.php +++ b/src/ncc/Exceptions/UserAbortedOperationException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class UserAbortedOperationException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::UserAbortedOperationException, $previous); + parent::__construct($message, ExceptionCodes::USER_ABORTED_OPERATION, $previous); } } \ No newline at end of file diff --git a/src/ncc/Exceptions/VersionNotFoundException.php b/src/ncc/Exceptions/VersionNotFoundException.php index c1348ea..f214435 100644 --- a/src/ncc/Exceptions/VersionNotFoundException.php +++ b/src/ncc/Exceptions/VersionNotFoundException.php @@ -23,7 +23,7 @@ namespace ncc\Exceptions; use Exception; - use ncc\Abstracts\ExceptionCodes; + use ncc\Enums\ExceptionCodes; use Throwable; class VersionNotFoundException extends Exception @@ -34,6 +34,6 @@ namespace ncc\Exceptions; */ public function __construct(string $message = "", ?Throwable $previous = null) { - parent::__construct($message, ExceptionCodes::VersionNotFoundException, $previous); + parent::__construct($message, ExceptionCodes::VERSION_NOT_FOUND, $previous); } } \ No newline at end of file diff --git a/src/ncc/Interfaces/CompilerInterface.php b/src/ncc/Interfaces/CompilerInterface.php index 7ab44de..799e588 100644 --- a/src/ncc/Interfaces/CompilerInterface.php +++ b/src/ncc/Interfaces/CompilerInterface.php @@ -22,7 +22,7 @@ namespace ncc\Interfaces; - use ncc\Abstracts\Options\BuildConfigurationValues; + use ncc\Enums\Options\BuildConfigurationValues; use ncc\Exceptions\AccessDeniedException; use ncc\Exceptions\BuildException; use ncc\Exceptions\FileNotFoundException; @@ -46,7 +46,7 @@ namespace ncc\Interfaces; * @param string $build_configuration The build configuration to use to build the project * @return void */ - public function prepare(string $build_configuration=BuildConfigurationValues::DefaultConfiguration): void; + public function prepare(string $build_configuration=BuildConfigurationValues::DEFAULT): void; /** * Executes the compile process in the correct order and returns the finalized Package object diff --git a/src/ncc/Managers/ConfigurationManager.php b/src/ncc/Managers/ConfigurationManager.php index 297c604..39adc27 100644 --- a/src/ncc/Managers/ConfigurationManager.php +++ b/src/ncc/Managers/ConfigurationManager.php @@ -25,7 +25,7 @@ namespace ncc\Managers; use Exception; - use ncc\Abstracts\Scopes; + use ncc\Enums\Scopes; use ncc\Exceptions\AccessDeniedException; use ncc\Exceptions\FileNotFoundException; use ncc\Exceptions\InvalidScopeException; @@ -91,7 +91,7 @@ { Console::outDebug(sprintf('saving configuration file to %s', PathFinder::getConfigurationFile())); - if(Resolver::resolveScope() !== Scopes::System) + if(Resolver::resolveScope() !== Scopes::SYSTEM) throw new AccessDeniedException('Cannot save configuration file, insufficient permissions'); if($this->Configuration == null) diff --git a/src/ncc/Managers/CredentialManager.php b/src/ncc/Managers/CredentialManager.php index 679b14d..6de26b7 100644 --- a/src/ncc/Managers/CredentialManager.php +++ b/src/ncc/Managers/CredentialManager.php @@ -25,8 +25,8 @@ namespace ncc\Managers; use Exception; - use ncc\Abstracts\Scopes; - use ncc\Abstracts\Versions; + use ncc\Enums\Scopes; + use ncc\Enums\Versions; use ncc\Exceptions\AccessDeniedException; use ncc\Exceptions\FileNotFoundException; use ncc\Exceptions\IOException; @@ -57,7 +57,7 @@ public function __construct() { /** @noinspection PhpUnhandledExceptionInspection */ - $this->CredentialsPath = PathFinder::getDataPath(Scopes::System) . DIRECTORY_SEPARATOR . 'credentials.store'; + $this->CredentialsPath = PathFinder::getDataPath(Scopes::SYSTEM) . DIRECTORY_SEPARATOR . 'credentials.store'; $this->Vault = null; try @@ -89,11 +89,11 @@ if(file_exists($this->CredentialsPath)) return; - if(Resolver::resolveScope() !== Scopes::System) + if(Resolver::resolveScope() !== Scopes::SYSTEM) throw new AccessDeniedException('Cannot construct credentials store without system permissions'); $VaultObject = new Vault(); - $VaultObject->Version = Versions::CredentialsStoreVersion; + $VaultObject->Version = Versions::CREDENTIALS_STORE_VERSION; IO::fwrite($this->CredentialsPath, ZiProto::encode($VaultObject->toArray()), 0744); } @@ -123,7 +123,7 @@ $VaultArray = ZiProto::decode(IO::fread($this->CredentialsPath)); $VaultObject = Vault::fromArray($VaultArray); - if($VaultObject->Version !== Versions::CredentialsStoreVersion) + if($VaultObject->Version !== Versions::CREDENTIALS_STORE_VERSION) throw new RuntimeException('Credentials store version mismatch'); $this->Vault = $VaultObject; @@ -141,7 +141,7 @@ { Console::outDebug(sprintf('saving credentials store to %s', $this->CredentialsPath)); - if(Resolver::resolveScope() !== Scopes::System) + if(Resolver::resolveScope() !== Scopes::SYSTEM) throw new AccessDeniedException('Cannot save credentials store without system permissions'); IO::fwrite($this->CredentialsPath, ZiProto::encode($this->Vault->toArray()), 0744); diff --git a/src/ncc/Managers/ExecutionPointerManager.php b/src/ncc/Managers/ExecutionPointerManager.php index 947908c..3f7f306 100644 --- a/src/ncc/Managers/ExecutionPointerManager.php +++ b/src/ncc/Managers/ExecutionPointerManager.php @@ -25,8 +25,8 @@ namespace ncc\Managers; use Exception; - use ncc\Abstracts\Runners; - use ncc\Abstracts\Scopes; + use ncc\Enums\Runners; + use ncc\Enums\Scopes; use ncc\Classes\BashExtension\BashRunner; use ncc\Classes\LuaExtension\LuaRunner; use ncc\Classes\NccExtension\ConstantCompiler; @@ -90,7 +90,7 @@ */ public function __construct() { - $this->RunnerPath = PathFinder::getRunnerPath(Scopes::System); + $this->RunnerPath = PathFinder::getRunnerPath(Scopes::SYSTEM); $this->TemporaryUnits = []; } @@ -170,7 +170,7 @@ */ public function addUnit(string $package, string $version, ExecutionUnit $unit, bool $temporary=false): void { - if(Resolver::resolveScope() !== Scopes::System) + if(Resolver::resolveScope() !== Scopes::SYSTEM) throw new AccessDeniedException('Cannot add new ExecutionUnit \'' . $unit->ExecutionPolicy->Name .'\' for ' . $package . ', insufficient permissions'); Console::outVerbose(sprintf('Adding new ExecutionUnit \'%s\' for %s', $unit->ExecutionPolicy->Name, $package)); @@ -200,12 +200,12 @@ $bin_file = $package_bin_path . DIRECTORY_SEPARATOR . hash('haval128,4', $unit->ExecutionPolicy->Name); $bin_file .= match ($unit->ExecutionPolicy->Runner) { - Runners::bash => BashRunner::getFileExtension(), - Runners::php => PhpRunner::getFileExtension(), - Runners::perl => PerlRunner::getFileExtension(), - Runners::python => PythonRunner::getFileExtension(), - Runners::python2 => Python2Runner::getFileExtension(), - Runners::python3 => Python3Runner::getFileExtension(), + Runners::BASH => BashRunner::getFileExtension(), + Runners::PHP => PhpRunner::getFileExtension(), + Runners::PERL => PerlRunner::getFileExtension(), + Runners::PYTHON => PythonRunner::getFileExtension(), + Runners::PYTHON_2 => Python2Runner::getFileExtension(), + Runners::PYTHON_3 => Python3Runner::getFileExtension(), Runners::lua => LuaRunner::getFileExtension(), default => throw new RunnerExecutionException('The runner \'' . $unit->ExecutionPolicy->Runner . '\' is not supported'), }; @@ -259,7 +259,7 @@ */ public function removeUnit(string $package, string $version, string $name): bool { - if(Resolver::resolveScope() !== Scopes::System) + if(Resolver::resolveScope() !== Scopes::SYSTEM) throw new AccessDeniedException('Cannot remove ExecutionUnit \'' . $name .'\' for ' . $package . ', insufficient permissions'); Console::outVerbose(sprintf('Removing ExecutionUnit \'%s\' for %s', $name, $package)); diff --git a/src/ncc/Managers/PackageLockManager.php b/src/ncc/Managers/PackageLockManager.php index 46134d6..0032e32 100644 --- a/src/ncc/Managers/PackageLockManager.php +++ b/src/ncc/Managers/PackageLockManager.php @@ -25,7 +25,7 @@ namespace ncc\Managers; use Exception; - use ncc\Abstracts\Scopes; + use ncc\Enums\Scopes; use ncc\Exceptions\AccessDeniedException; use ncc\Exceptions\IOException; use ncc\Exceptions\PackageLockException; @@ -55,7 +55,7 @@ public function __construct() { /** @noinspection PhpUnhandledExceptionInspection */ - $this->PackageLockPath = PathFinder::getPackageLock(Scopes::System); + $this->PackageLockPath = PathFinder::getPackageLock(Scopes::SYSTEM); try { @@ -131,7 +131,7 @@ return; } - if(Resolver::resolveScope() !== Scopes::System) + if(Resolver::resolveScope() !== Scopes::SYSTEM) throw new AccessDeniedException('Cannot write to PackageLock, insufficient permissions'); try diff --git a/src/ncc/Managers/PackageManager.php b/src/ncc/Managers/PackageManager.php index 70200e1..324e1a1 100644 --- a/src/ncc/Managers/PackageManager.php +++ b/src/ncc/Managers/PackageManager.php @@ -25,14 +25,14 @@ namespace ncc\Managers; use Exception; - use ncc\Abstracts\CompilerExtensions; - use ncc\Abstracts\ConstantReferences; - use ncc\Abstracts\DependencySourceType; - use ncc\Abstracts\LogLevel; - use ncc\Abstracts\Options\InstallPackageOptions; - use ncc\Abstracts\RemoteSourceType; - use ncc\Abstracts\Scopes; - use ncc\Abstracts\Versions; + use ncc\Enums\CompilerExtensions; + use ncc\Enums\ConstantReferences; + use ncc\Enums\DependencySourceType; + use ncc\Enums\LogLevel; + use ncc\Enums\Options\InstallPackageOptions; + use ncc\Enums\RemoteSourceType; + use ncc\Enums\Scopes; + use ncc\Enums\Versions; use ncc\Classes\ComposerExtension\ComposerSourceBuiltin; use ncc\Classes\GitClient; use ncc\Classes\NccExtension\PackageCompiler; @@ -95,7 +95,7 @@ */ public function __construct() { - $this->PackagesPath = PathFinder::getPackagesPath(Scopes::System); + $this->PackagesPath = PathFinder::getPackagesPath(Scopes::SYSTEM); $this->PackageLockManager = new PackageLockManager(); $this->PackageLockManager->load(); } @@ -126,7 +126,7 @@ */ public function install(string $package_path, ?Entry $entry=null, array $options=[]): string { - if(Resolver::resolveScope() !== Scopes::System) + if(Resolver::resolveScope() !== Scopes::SYSTEM) throw new AccessDeniedException('Insufficient permission to install packages'); if(!file_exists($package_path) || !is_file($package_path) || !is_readable($package_path)) @@ -151,7 +151,7 @@ if($this->getPackageVersion($package->Assembly->Package, $package->Assembly->Version) !== null) { - if(in_array(InstallPackageOptions::Reinstall, $options)) + if(in_array(InstallPackageOptions::REINSTALL, $options)) { if($this->getPackageLockManager()->getPackageLock()->packageExists( $package->Assembly->Package, $package->Assembly->Version @@ -170,15 +170,15 @@ $execution_pointer_manager = new ExecutionPointerManager(); PackageCompiler::compilePackageConstants($package, [ - ConstantReferences::Install => $installation_paths + ConstantReferences::INSTALL => $installation_paths ]); // Process all the required dependencies before installing the package - if($package->Dependencies !== null && count($package->Dependencies) > 0 && !in_array(InstallPackageOptions::SkipDependencies, $options)) + if($package->Dependencies !== null && count($package->Dependencies) > 0 && !in_array(InstallPackageOptions::SKIP_DEPENDENCIES, $options)) { foreach($package->Dependencies as $dependency) { - if(in_array(InstallPackageOptions::Reinstall, $options)) + if(in_array(InstallPackageOptions::REINSTALL, $options)) { // Uninstall the dependency if the option Reinstall is passed on if($this->getPackageLockManager()->getPackageLock()->packageExists($dependency->Name, $dependency->Version)) @@ -200,7 +200,7 @@ Console::outVerbose(sprintf('Installing %s', $package_path)); - if(Resolver::checkLogLevel(LogLevel::Debug, Main::getLogLevel())) + if(Resolver::checkLogLevel(LogLevel::DEBUG, Main::getLogLevel())) { Console::outDebug(sprintf('installer.install_path: %s', $installation_paths->getInstallationPath())); Console::outDebug(sprintf('installer.data_path: %s', $installation_paths->getDataPath())); @@ -450,12 +450,12 @@ if($input->Package == null) throw new PackageFetchException('No package specified'); if($input->Version == null) - $input->Version = Versions::Latest; + $input->Version = Versions::LATEST; Console::outVerbose('Fetching package ' . $input->Package . ' from ' . $input->Source . ' (' . $input->Version . ')'); $remote_source_type = Resolver::detectRemoteSourceType($input->Source); - if($remote_source_type == RemoteSourceType::Builtin) + if($remote_source_type == RemoteSourceType::BUILTIN) { Console::outDebug('using builtin source ' . $input->Source); switch($input->Source) @@ -475,7 +475,7 @@ } } - if($remote_source_type == RemoteSourceType::Defined) + if($remote_source_type == RemoteSourceType::DEFINED) { Console::outDebug('using defined source ' . $input->Source); $remote_source_manager = new RemoteSourcesManager(); @@ -665,7 +665,7 @@ Console::outVerbose(sprintf('Installing dependency %s=%s for %s=%s', $dependency->Name, $dependency->Version, $package->Assembly->Package, $package->Assembly->Version)); switch ($dependency->SourceType) { - case DependencySourceType::Local: + case DependencySourceType::LOCAL: Console::outDebug('installing from local source ' . $dependency->Source); $basedir = dirname($package_path); if (!file_exists($basedir . DIRECTORY_SEPARATOR . $dependency->Source)) @@ -674,10 +674,10 @@ RuntimeCache::set(sprintf('dependency_installed.%s=%s', $dependency->Name, $dependency->Version), true); break; - case DependencySourceType::StaticLinking: + case DependencySourceType::STATIC: throw new PackageNotFoundException('Static linking not possible, package ' . $dependency->Name . ' is not installed'); - case DependencySourceType::RemoteSource: + case DependencySourceType::REMOTE: Console::outDebug('installing from remote source ' . $dependency->Source); $this->installFromSource($dependency->Source, $entry, $options); RuntimeCache::set(sprintf('dependency_installed.%s=%s', $dependency->Name, $dependency->Version), true); @@ -855,7 +855,7 @@ */ public function uninstallPackageVersion(string $package, string $version): void { - if(Resolver::resolveScope() !== Scopes::System) + if(Resolver::resolveScope() !== Scopes::SYSTEM) throw new AccessDeniedException('Insufficient permission to uninstall packages'); $version_entry = $this->getPackageVersion($package, $version); @@ -924,7 +924,7 @@ */ public function uninstallPackage(string $package): void { - if(Resolver::resolveScope() !== Scopes::System) + if(Resolver::resolveScope() !== Scopes::SYSTEM) throw new AccessDeniedException('Insufficient permission to uninstall packages'); $package_entry = $this->getPackage($package); diff --git a/src/ncc/Managers/ProjectManager.php b/src/ncc/Managers/ProjectManager.php index 9e28ba6..49db8d3 100644 --- a/src/ncc/Managers/ProjectManager.php +++ b/src/ncc/Managers/ProjectManager.php @@ -24,8 +24,8 @@ namespace ncc\Managers; - use ncc\Abstracts\Options\BuildConfigurationValues; - use ncc\Abstracts\Options\InitializeProjectOptions; + use ncc\Enums\Options\BuildConfigurationValues; + use ncc\Enums\Options\InitializeProjectOptions; use ncc\Classes\NccExtension\PackageCompiler; use ncc\Exceptions\AccessDeniedException; use ncc\Exceptions\BuildConfigurationNotFoundException; @@ -290,7 +290,7 @@ * @throws PackagePreparationFailedException * @throws UnsupportedCompilerExtensionException */ - public function build(string $build_configuration=BuildConfigurationValues::DefaultConfiguration): string + public function build(string $build_configuration=BuildConfigurationValues::DEFAULT): string { return PackageCompiler::compile($this, $build_configuration); } diff --git a/src/ncc/Managers/RemoteSourcesManager.php b/src/ncc/Managers/RemoteSourcesManager.php index dc1f884..105907f 100644 --- a/src/ncc/Managers/RemoteSourcesManager.php +++ b/src/ncc/Managers/RemoteSourcesManager.php @@ -25,7 +25,7 @@ namespace ncc\Managers; use Exception; - use ncc\Abstracts\Scopes; + use ncc\Enums\Scopes; use ncc\Exceptions\InvalidScopeException; use ncc\Exceptions\IOException; use ncc\Objects\DefinedRemoteSource; @@ -56,7 +56,7 @@ */ public function __construct() { - $this->DefinedSourcesPath = PathFinder::getRemoteSources(Scopes::System); + $this->DefinedSourcesPath = PathFinder::getRemoteSources(Scopes::SYSTEM); $this->load(); } diff --git a/src/ncc/Managers/SymlinkManager.php b/src/ncc/Managers/SymlinkManager.php index ce3e2e1..c34643a 100644 --- a/src/ncc/Managers/SymlinkManager.php +++ b/src/ncc/Managers/SymlinkManager.php @@ -25,7 +25,7 @@ namespace ncc\Managers; use Exception; - use ncc\Abstracts\Scopes; + use ncc\Enums\Scopes; use ncc\Exceptions\AccessDeniedException; use ncc\Exceptions\SymlinkException; use ncc\Objects\SymlinkDictionary\SymlinkEntry; @@ -64,7 +64,7 @@ { try { - $this->SymlinkDictionaryPath = PathFinder::getSymlinkDictionary(Scopes::System); + $this->SymlinkDictionaryPath = PathFinder::getSymlinkDictionary(Scopes::SYSTEM); $this->load(); } catch(Exception $e) @@ -134,7 +134,7 @@ */ private function save(bool $throw_exception=true): void { - if(Resolver::resolveScope() !== Scopes::System) + if(Resolver::resolveScope() !== Scopes::SYSTEM) throw new AccessDeniedException('Insufficient Permissions to write to the system symlink dictionary'); Console::outDebug(sprintf('saving symlink dictionary to %s', $this->SymlinkDictionaryPath)); @@ -206,7 +206,7 @@ */ public function add(string $package, string $unit='main'): void { - if(Resolver::resolveScope() !== Scopes::System) + if(Resolver::resolveScope() !== Scopes::SYSTEM) throw new AccessDeniedException('Insufficient Permissions to add to the system symlink dictionary'); if($this->exists($package)) @@ -230,7 +230,7 @@ */ public function remove(string $package): void { - if(Resolver::resolveScope() !== Scopes::System) + if(Resolver::resolveScope() !== Scopes::SYSTEM) throw new AccessDeniedException('Insufficient Permissions to remove from the system symlink dictionary'); if(!$this->exists($package)) @@ -291,7 +291,7 @@ */ public function sync(): void { - if(Resolver::resolveScope() !== Scopes::System) + if(Resolver::resolveScope() !== Scopes::SYSTEM) throw new AccessDeniedException('Insufficient Permissions to sync the system symlink dictionary'); $filesystem = new Filesystem(); diff --git a/src/ncc/Objects/CliHelpSection.php b/src/ncc/Objects/CliHelpSection.php index c8913a5..2e341f1 100644 --- a/src/ncc/Objects/CliHelpSection.php +++ b/src/ncc/Objects/CliHelpSection.php @@ -24,7 +24,7 @@ namespace ncc\Objects; - use ncc\Abstracts\ConsoleColors; + use ncc\Enums\ConsoleColors; use ncc\Utilities\Console; class CliHelpSection @@ -120,7 +120,7 @@ if(!$basic) { - $result = Console::formatColor($result, ConsoleColors::Green); + $result = Console::formatColor($result, ConsoleColors::GREEN); } $out[] .= $result; @@ -133,7 +133,7 @@ } else { - $out[] .= Console::formatColor(implode(' ', $this->Parameters), ConsoleColors::Green); + $out[] .= Console::formatColor(implode(' ', $this->Parameters), ConsoleColors::GREEN); } } } diff --git a/src/ncc/Objects/ComposerJson.php b/src/ncc/Objects/ComposerJson.php index f92f818..bd84399 100644 --- a/src/ncc/Objects/ComposerJson.php +++ b/src/ncc/Objects/ComposerJson.php @@ -24,8 +24,8 @@ namespace ncc\Objects; - use ncc\Abstracts\ComposerPackageTypes; - use ncc\Abstracts\ComposerStabilityTypes; + use ncc\Enums\ComposerPackageTypes; + use ncc\Enums\ComposerStabilityTypes; use ncc\Objects\ComposerJson\Author; use ncc\Objects\ComposerJson\Autoloader; use ncc\Objects\ComposerJson\PackageLink; @@ -296,8 +296,8 @@ public function __construct() { - $this->Type = ComposerPackageTypes::Library; - $this->MinimumStability = ComposerStabilityTypes::Stable; + $this->Type = ComposerPackageTypes::LIBRARY; + $this->MinimumStability = ComposerStabilityTypes::STABLE; $this->PreferStable = false; $this->Abandoned = false; } diff --git a/src/ncc/Objects/DefinedRemoteSource.php b/src/ncc/Objects/DefinedRemoteSource.php index de63655..ae7a020 100644 --- a/src/ncc/Objects/DefinedRemoteSource.php +++ b/src/ncc/Objects/DefinedRemoteSource.php @@ -24,7 +24,7 @@ namespace ncc\Objects; - use ncc\Abstracts\DefinedRemoteSourceType; + use ncc\Enums\DefinedRemoteSourceType; use ncc\Utilities\Functions; class DefinedRemoteSource diff --git a/src/ncc/Objects/HttpRequest.php b/src/ncc/Objects/HttpRequest.php index 138f76e..bf228f7 100644 --- a/src/ncc/Objects/HttpRequest.php +++ b/src/ncc/Objects/HttpRequest.php @@ -24,7 +24,7 @@ namespace ncc\Objects; - use ncc\Abstracts\HttpRequestType; + use ncc\Enums\HttpRequestType; class HttpRequest { diff --git a/src/ncc/Objects/Package.php b/src/ncc/Objects/Package.php index e5fce9d..2ac235d 100644 --- a/src/ncc/Objects/Package.php +++ b/src/ncc/Objects/Package.php @@ -25,8 +25,8 @@ namespace ncc\Objects; use Exception; - use ncc\Abstracts\EncoderType; - use ncc\Abstracts\PackageStructureVersions; + use ncc\Enums\EncoderType; + use ncc\Enums\PackageStructureVersions; use ncc\Exceptions\FileNotFoundException; use ncc\Exceptions\InvalidPackageException; use ncc\Exceptions\InvalidProjectConfigurationException; @@ -271,25 +271,25 @@ switch($encoding_type) { case '300': - $magic_bytes->Encoder = EncoderType::ZiProto; + $magic_bytes->Encoder = EncoderType::ZI_PROTO; $magic_bytes->IsCompressed = false; $magic_bytes->IsEncrypted = false; break; case '301': - $magic_bytes->Encoder = EncoderType::ZiProto; + $magic_bytes->Encoder = EncoderType::ZI_PROTO; $magic_bytes->IsCompressed = true; $magic_bytes->IsEncrypted = false; break; case '310': - $magic_bytes->Encoder = EncoderType::ZiProto; + $magic_bytes->Encoder = EncoderType::ZI_PROTO; $magic_bytes->IsCompressed = false; $magic_bytes->IsEncrypted = true; break; case '311': - $magic_bytes->Encoder = EncoderType::ZiProto; + $magic_bytes->Encoder = EncoderType::ZI_PROTO; $magic_bytes->IsCompressed = true; $magic_bytes->IsEncrypted = true; break; diff --git a/src/ncc/Objects/Package/MagicBytes.php b/src/ncc/Objects/Package/MagicBytes.php index 692a5ba..3f686cd 100644 --- a/src/ncc/Objects/Package/MagicBytes.php +++ b/src/ncc/Objects/Package/MagicBytes.php @@ -24,8 +24,8 @@ namespace ncc\Objects\Package; - use ncc\Abstracts\EncoderType; - use ncc\Abstracts\Versions; + use ncc\Enums\EncoderType; + use ncc\Enums\Versions; class MagicBytes { @@ -76,8 +76,8 @@ */ public function __construct() { - $this->PackageStructureVersion = Versions::PackageStructureVersion; - $this->Encoder = EncoderType::ZiProto; + $this->PackageStructureVersion = Versions::PACKAGE_STRUCTURE_VERSION; + $this->Encoder = EncoderType::ZI_PROTO; $this->IsCompressed = false; $this->IsEncrypted = false; $this->IsInstallable = false; diff --git a/src/ncc/Objects/PackageLock.php b/src/ncc/Objects/PackageLock.php index 69deea5..13f75c0 100644 --- a/src/ncc/Objects/PackageLock.php +++ b/src/ncc/Objects/PackageLock.php @@ -24,7 +24,7 @@ namespace ncc\Objects; - use ncc\Abstracts\Versions; + use ncc\Enums\Versions; use ncc\Exceptions\InvalidPackageNameException; use ncc\Exceptions\InvalidScopeException; use ncc\Exceptions\VersionNotFoundException; @@ -60,7 +60,7 @@ */ public function __construct() { - $this->PackageLockVersion = Versions::PackageLockVersion; + $this->PackageLockVersion = Versions::PACKAGE_LOCK_VERSION; $this->Packages = []; } @@ -71,7 +71,7 @@ */ private function update(): void { - $this->PackageLockVersion = Versions::PackageLockVersion; + $this->PackageLockVersion = Versions::PACKAGE_LOCK_VERSION; $this->LastUpdatedTimestamp = time(); } diff --git a/src/ncc/Objects/PackageLock/PackageEntry.php b/src/ncc/Objects/PackageLock/PackageEntry.php index 4507a44..39a21fb 100644 --- a/src/ncc/Objects/PackageLock/PackageEntry.php +++ b/src/ncc/Objects/PackageLock/PackageEntry.php @@ -24,8 +24,8 @@ namespace ncc\Objects\PackageLock; - use ncc\Abstracts\Scopes; - use ncc\Abstracts\Versions; + use ncc\Enums\Scopes; + use ncc\Enums\Versions; use ncc\Exceptions\InvalidPackageNameException; use ncc\Exceptions\InvalidScopeException; use ncc\Exceptions\VersionNotFoundException; @@ -85,7 +85,7 @@ */ public function getVersion(string $version, bool $throw_exception=false): ?VersionEntry { - if($version === Versions::Latest && $this->LatestVersion !== null) + if($version === Versions::LATEST && $this->LatestVersion !== null) { /** @noinspection CallableParameterUseCaseInTypeContextInspection */ $version = $this->LatestVersion; @@ -253,7 +253,7 @@ { $path = PathFinder::getPackageDataPath($this->Name); - if(!file_exists($path) && Resolver::resolveScope() === Scopes::System) + if(!file_exists($path) && Resolver::resolveScope() === Scopes::SYSTEM) { $filesystem = new Filesystem(); $filesystem->mkdir($path); diff --git a/src/ncc/Objects/ProjectConfiguration.php b/src/ncc/Objects/ProjectConfiguration.php index 01aa4af..5a9ff85 100644 --- a/src/ncc/Objects/ProjectConfiguration.php +++ b/src/ncc/Objects/ProjectConfiguration.php @@ -25,7 +25,7 @@ namespace ncc\Objects; use Exception; - use ncc\Abstracts\Options\BuildConfigurationValues; + use ncc\Enums\Options\BuildConfigurationValues; use ncc\Exceptions\AccessDeniedException; use ncc\Exceptions\BuildConfigurationNotFoundException; use ncc\Exceptions\FileNotFoundException; @@ -129,7 +129,7 @@ try { - $this->getRequiredExecutionPolicies(BuildConfigurationValues::AllConfigurations); + $this->getRequiredExecutionPolicies(BuildConfigurationValues::ALL); } catch(Exception $e) { @@ -165,10 +165,10 @@ return false; } - if($this->Build->Main == BuildConfigurationValues::AllConfigurations) + if($this->Build->Main == BuildConfigurationValues::ALL) { if($throw_exception) - throw new InvalidBuildConfigurationException(sprintf('Build configuration build.main cannot be set to "%s"', BuildConfigurationValues::AllConfigurations)); + throw new InvalidBuildConfigurationException(sprintf('Build configuration build.main cannot be set to "%s"', BuildConfigurationValues::ALL)); return false; } } @@ -199,7 +199,7 @@ * @throws BuildConfigurationNotFoundException * @throws UndefinedExecutionPolicyException */ - public function getRequiredExecutionPolicies(string $build_configuration=BuildConfigurationValues::DefaultConfiguration): array + public function getRequiredExecutionPolicies(string $build_configuration=BuildConfigurationValues::DEFAULT): array { if($this->ExecutionPolicies == null || count($this->ExecutionPolicies) == 0) return []; @@ -257,7 +257,7 @@ switch($build_configuration) { - case BuildConfigurationValues::AllConfigurations: + case BuildConfigurationValues::ALL: /** @var BuildConfiguration $configuration */ foreach($this->Build->Configurations as $configuration) { diff --git a/src/ncc/Objects/ProjectConfiguration/Assembly.php b/src/ncc/Objects/ProjectConfiguration/Assembly.php index 9d6c5bc..1daf921 100644 --- a/src/ncc/Objects/ProjectConfiguration/Assembly.php +++ b/src/ncc/Objects/ProjectConfiguration/Assembly.php @@ -24,7 +24,7 @@ namespace ncc\Objects\ProjectConfiguration; - use ncc\Abstracts\RegexPatterns; + use ncc\Enums\RegexPatterns; use ncc\Exceptions\InvalidProjectConfigurationException; use ncc\Utilities\Functions; use ncc\Utilities\Validate; @@ -120,7 +120,7 @@ return false; } - if($this->Package !== null && !preg_match(RegexPatterns::PackageNameFormat, $this->Package)) + if($this->Package !== null && !preg_match(RegexPatterns::PACKAGE_NAME_FORMAT, $this->Package)) { if($throw_exception) throw new InvalidProjectConfigurationException('The package name is invalid', 'Assembly.Package'); diff --git a/src/ncc/Objects/ProjectConfiguration/Build.php b/src/ncc/Objects/ProjectConfiguration/Build.php index d81323c..ab1e750 100644 --- a/src/ncc/Objects/ProjectConfiguration/Build.php +++ b/src/ncc/Objects/ProjectConfiguration/Build.php @@ -24,7 +24,7 @@ namespace ncc\Objects\ProjectConfiguration; - use ncc\Abstracts\Options\BuildConfigurationValues; + use ncc\Enums\Options\BuildConfigurationValues; use ncc\Exceptions\BuildConfigurationNotFoundException; use ncc\Exceptions\InvalidBuildConfigurationException; use ncc\Exceptions\InvalidConstantNameException; @@ -262,7 +262,7 @@ */ public function getBuildConfiguration(string $name): BuildConfiguration { - if($name == BuildConfigurationValues::DefaultConfiguration) + if($name == BuildConfigurationValues::DEFAULT) $name = $this->DefaultConfiguration; foreach($this->Configurations as $configuration) diff --git a/src/ncc/Objects/ProjectConfiguration/Compiler.php b/src/ncc/Objects/ProjectConfiguration/Compiler.php index 64ce759..db68b55 100644 --- a/src/ncc/Objects/ProjectConfiguration/Compiler.php +++ b/src/ncc/Objects/ProjectConfiguration/Compiler.php @@ -25,8 +25,8 @@ namespace ncc\Objects\ProjectConfiguration; use Exception; - use ncc\Abstracts\CompilerExtensions; - use ncc\Abstracts\CompilerExtensionSupportedVersions; + use ncc\Enums\CompilerExtensions; + use ncc\Enums\CompilerExtensionSupportedVersions; use ncc\Exceptions\InvalidPropertyValueException; use ncc\Exceptions\InvalidVersionConfigurationException; use ncc\Exceptions\RuntimeException; @@ -110,7 +110,7 @@ throw new RuntimeException('Version comparison failed: ' . $e->getMessage()); } - if(!in_array($this->Extension, CompilerExtensions::All)) + if(!in_array($this->Extension, CompilerExtensions::ALL)) { if($throw_exception) throw new UnsupportedCompilerExtensionException('The compiler extension \'' . $this->Extension . '\' is not supported'); diff --git a/src/ncc/Objects/RemotePackageInput.php b/src/ncc/Objects/RemotePackageInput.php index 8ae5b36..4ab290c 100644 --- a/src/ncc/Objects/RemotePackageInput.php +++ b/src/ncc/Objects/RemotePackageInput.php @@ -24,7 +24,7 @@ namespace ncc\Objects; - use ncc\Abstracts\RegexPatterns; + use ncc\Enums\RegexPatterns; class RemotePackageInput { @@ -60,7 +60,7 @@ */ public function __construct(?string $input=null) { - if($input !== null && preg_match(RegexPatterns::RemotePackage, $input, $matches)) + if($input !== null && preg_match(RegexPatterns::REMOTE_PACKAGE, $input, $matches)) { $this->Vendor = $matches['vendor']; $this->Package = $matches['package']; diff --git a/src/ncc/Objects/Vault.php b/src/ncc/Objects/Vault.php index f3e9517..f7f55aa 100644 --- a/src/ncc/Objects/Vault.php +++ b/src/ncc/Objects/Vault.php @@ -24,8 +24,8 @@ namespace ncc\Objects; - use ncc\Abstracts\AuthenticationType; - use ncc\Abstracts\Versions; + use ncc\Enums\AuthenticationType; + use ncc\Enums\Versions; use ncc\Exceptions\RuntimeException; use ncc\Interfaces\PasswordInterface; use ncc\Objects\Vault\Entry; @@ -52,7 +52,7 @@ */ public function __construct() { - $this->Version = Versions::CredentialsStoreVersion; + $this->Version = Versions::CREDENTIALS_STORE_VERSION; $this->Entries = []; } @@ -163,10 +163,10 @@ $input = []; switch($entry->getPassword()->getAuthenticationType()) { - case AuthenticationType::UsernamePassword: + case AuthenticationType::USERNAME_PASSWORD: $input = ['password' => $password]; break; - case AuthenticationType::AccessToken: + case AuthenticationType::ACCESS_TOKEN: $input = ['token' => $password]; break; } diff --git a/src/ncc/Objects/Vault/Entry.php b/src/ncc/Objects/Vault/Entry.php index 4445ca7..9df096f 100644 --- a/src/ncc/Objects/Vault/Entry.php +++ b/src/ncc/Objects/Vault/Entry.php @@ -24,7 +24,7 @@ namespace ncc\Objects\Vault; - use ncc\Abstracts\AuthenticationType; + use ncc\Enums\AuthenticationType; use ncc\Defuse\Crypto\Crypto; use ncc\Defuse\Crypto\Exception\EnvironmentIsBrokenException; use ncc\Defuse\Crypto\Exception\WrongKeyOrModifiedCiphertextException; @@ -96,7 +96,7 @@ switch($this->Password->getAuthenticationType()) { - case AuthenticationType::UsernamePassword: + case AuthenticationType::USERNAME_PASSWORD: if(!($this->Password instanceof UsernamePassword)) return false; @@ -114,7 +114,7 @@ return $username == $this->Password->getUsername() && $password == $this->Password->getPassword(); - case AuthenticationType::AccessToken: + case AuthenticationType::ACCESS_TOKEN: if(!($this->Password instanceof AccessToken)) return false; @@ -294,8 +294,8 @@ { $self->Password = match (Functions::array_bc($password, 'authentication_type')) { - AuthenticationType::UsernamePassword => UsernamePassword::fromArray($password), - AuthenticationType::AccessToken => AccessToken::fromArray($password) + AuthenticationType::USERNAME_PASSWORD => UsernamePassword::fromArray($password), + AuthenticationType::ACCESS_TOKEN => AccessToken::fromArray($password) }; } } diff --git a/src/ncc/Objects/Vault/Password/AccessToken.php b/src/ncc/Objects/Vault/Password/AccessToken.php index 66b2d69..81214fe 100644 --- a/src/ncc/Objects/Vault/Password/AccessToken.php +++ b/src/ncc/Objects/Vault/Password/AccessToken.php @@ -24,7 +24,7 @@ namespace ncc\Objects\Vault\Password; - use ncc\Abstracts\AuthenticationType; + use ncc\Enums\AuthenticationType; use ncc\Interfaces\PasswordInterface; use ncc\Utilities\Functions; @@ -46,7 +46,7 @@ public function toArray(bool $bytecode=false): array { return [ - ($bytecode ? Functions::cbc('authentication_type') : 'authentication_type') => AuthenticationType::AccessToken, + ($bytecode ? Functions::cbc('authentication_type') : 'authentication_type') => AuthenticationType::ACCESS_TOKEN, ($bytecode ? Functions::cbc('access_token') : 'access_token') => $this->AccessToken, ]; } @@ -79,7 +79,7 @@ */ public function getAuthenticationType(): string { - return AuthenticationType::AccessToken; + return AuthenticationType::ACCESS_TOKEN; } /** diff --git a/src/ncc/Objects/Vault/Password/UsernamePassword.php b/src/ncc/Objects/Vault/Password/UsernamePassword.php index de11f39..cee115e 100644 --- a/src/ncc/Objects/Vault/Password/UsernamePassword.php +++ b/src/ncc/Objects/Vault/Password/UsernamePassword.php @@ -24,7 +24,7 @@ namespace ncc\Objects\Vault\Password; - use ncc\Abstracts\AuthenticationType; + use ncc\Enums\AuthenticationType; use ncc\Interfaces\PasswordInterface; use ncc\Utilities\Functions; @@ -53,7 +53,7 @@ public function toArray(bool $bytecode=false): array { return [ - ($bytecode ? Functions::cbc('authentication_type') : 'authentication_type') => AuthenticationType::UsernamePassword, + ($bytecode ? Functions::cbc('authentication_type') : 'authentication_type') => AuthenticationType::USERNAME_PASSWORD, ($bytecode ? Functions::cbc('username') : 'username') => $this->Username, ($bytecode ? Functions::cbc('password') : 'password') => $this->Password, ]; @@ -98,7 +98,7 @@ */ public function getAuthenticationType(): string { - return AuthenticationType::UsernamePassword; + return AuthenticationType::USERNAME_PASSWORD; } /** diff --git a/src/ncc/Runtime.php b/src/ncc/Runtime.php index b9ab941..6a6d07b 100644 --- a/src/ncc/Runtime.php +++ b/src/ncc/Runtime.php @@ -25,8 +25,8 @@ namespace ncc; use Exception; - use ncc\Abstracts\CompilerExtensions; - use ncc\Abstracts\Versions; + use ncc\Enums\CompilerExtensions; + use ncc\Enums\Versions; use ncc\Classes\PhpExtension\PhpRuntime; use ncc\Exceptions\ConstantReadonlyException; use ncc\Exceptions\ImportException; @@ -59,9 +59,9 @@ * @return bool * @throws PackageLockException */ - private static function isImported(string $package, string $version=Versions::Latest): bool + private static function isImported(string $package, string $version=Versions::LATEST): bool { - if($version == Versions::Latest) + if($version == Versions::LATEST) $version = self::getPackageManager()->getPackage($package)->getLatestVersion(); $entry = "$package=$version"; @@ -90,7 +90,7 @@ * @return void * @throws ImportException */ - public static function import(string $package, string $version=Versions::Latest, array $options=[]): void + public static function import(string $package, string $version=Versions::LATEST, array $options=[]): void { try { @@ -105,7 +105,7 @@ throw new ImportException(sprintf("Package '%s' not found", $package)); } - if($version == Versions::Latest) + if($version == Versions::LATEST) $version = $package_entry->getLatestVersion(); try diff --git a/src/ncc/Utilities/Console.php b/src/ncc/Utilities/Console.php index 8c7b45d..b2b1067 100644 --- a/src/ncc/Utilities/Console.php +++ b/src/ncc/Utilities/Console.php @@ -25,8 +25,8 @@ namespace ncc\Utilities; use Exception; - use ncc\Abstracts\ConsoleColors; - use ncc\Abstracts\LogLevel; + use ncc\Enums\ConsoleColors; + use ncc\Enums\LogLevel; use ncc\CLI\Main; use ncc\ncc; use Throwable; @@ -62,9 +62,9 @@ { switch(Main::getLogLevel()) { - case LogLevel::Verbose: - case LogLevel::Debug: - case LogLevel::Silent: + case LogLevel::VERBOSE: + case LogLevel::DEBUG: + case LogLevel::SILENT: return; default: @@ -133,13 +133,13 @@ private static function setPrefix(string $log_level, string $input): string { $input = match ($log_level) { - LogLevel::Verbose => self::formatColor('VRB:', ConsoleColors::LightCyan) . " $input", - LogLevel::Debug => self::formatColor('DBG:', ConsoleColors::LightMagenta) . " $input", - LogLevel::Info => self::formatColor('INF:', ConsoleColors::White) . " $input", - LogLevel::Warning => self::formatColor('WRN:', ConsoleColors::Yellow) . " $input", - LogLevel::Error => self::formatColor('ERR:', ConsoleColors::LightRed) . " $input", - LogLevel::Fatal => self::formatColor('FTL:', ConsoleColors::LightRed) . " $input", - default => self::formatColor('MSG:', ConsoleColors::Default) . " $input", + LogLevel::VERBOSE => self::formatColor('VRB:', ConsoleColors::LIGHT_CYAN) . " $input", + LogLevel::DEBUG => self::formatColor('DBG:', ConsoleColors::LIGHT_MAGENTA) . " $input", + LogLevel::INFO => self::formatColor('INF:', ConsoleColors::WHITE) . " $input", + LogLevel::WARNING => self::formatColor('WRN:', ConsoleColors::YELLOW) . " $input", + LogLevel::ERROR => self::formatColor('ERR:', ConsoleColors::LIGHT_RED) . " $input", + LogLevel::FATAL => self::formatColor('FTL:', ConsoleColors::LIGHT_RED) . " $input", + default => self::formatColor('MSG:', ConsoleColors::DEFAULT) . " $input", }; $tick_time = (string)microtime(true); @@ -162,11 +162,11 @@ if ($timeDiff > 1.0) { - $fmt_tick = Console::formatColor($tick_time, ConsoleColors::LightRed); + $fmt_tick = Console::formatColor($tick_time, ConsoleColors::LIGHT_RED); } elseif ($timeDiff > 0.5) { - $fmt_tick = Console::formatColor($tick_time, ConsoleColors::LightYellow); + $fmt_tick = Console::formatColor($tick_time, ConsoleColors::LIGHT_YELLOW); } } @@ -187,11 +187,11 @@ if(!ncc::cliMode()) return; - if(Main::getLogLevel() !== null && !Resolver::checkLogLevel(LogLevel::Info, Main::getLogLevel())) + if(Main::getLogLevel() !== null && !Resolver::checkLogLevel(LogLevel::INFO, Main::getLogLevel())) return; - if(Main::getLogLevel() !== null && Resolver::checkLogLevel(LogLevel::Verbose, Main::getLogLevel()) && !$no_prefix) - $message = self::setPrefix(LogLevel::Info, $message); + if(Main::getLogLevel() !== null && Resolver::checkLogLevel(LogLevel::VERBOSE, Main::getLogLevel()) && !$no_prefix) + $message = self::setPrefix(LogLevel::INFO, $message); if($newline) { @@ -214,7 +214,7 @@ if(!ncc::cliMode()) return; - if(Main::getLogLevel() !== null && !Resolver::checkLogLevel(LogLevel::Debug, Main::getLogLevel())) + if(Main::getLogLevel() !== null && !Resolver::checkLogLevel(LogLevel::DEBUG, Main::getLogLevel())) return; $backtrace = null; @@ -223,22 +223,22 @@ $trace_msg = null; if($backtrace !== null && isset($backtrace[1])) { - $trace_msg = Console::formatColor($backtrace[1]['class'], ConsoleColors::LightGray); + $trace_msg = Console::formatColor($backtrace[1]['class'], ConsoleColors::LIGHT_GREY); $trace_msg .= $backtrace[1]['type']; - $trace_msg .= Console::formatColor($backtrace[1]['function'] . '()', ConsoleColors::LightGreen); + $trace_msg .= Console::formatColor($backtrace[1]['function'] . '()', ConsoleColors::LIGHT_GREEN); $trace_msg .= ' > '; } /** Apply syntax highlighting using regular expressions */ // Hyperlinks - $message = preg_replace('/(https?:\/\/[^\s]+)/', Console::formatColor('$1', ConsoleColors::LightBlue), $message); + $message = preg_replace('/(https?:\/\/[^\s]+)/', Console::formatColor('$1', ConsoleColors::LIGHT_BLUE), $message); // File Paths - $message = preg_replace('/(\/[^\s]+)/', Console::formatColor('$1', ConsoleColors::LightCyan), $message); + $message = preg_replace('/(\/[^\s]+)/', Console::formatColor('$1', ConsoleColors::LIGHT_CYAN), $message); /** @noinspection PhpUnnecessaryStringCastInspection */ - $message = self::setPrefix(LogLevel::Debug, (string)$trace_msg . $message); + $message = self::setPrefix(LogLevel::DEBUG, (string)$trace_msg . $message); self::out($message, $newline, true); } @@ -255,10 +255,10 @@ if(!ncc::cliMode()) return; - if(Main::getLogLevel() !== null && !Resolver::checkLogLevel(LogLevel::Verbose, Main::getLogLevel())) + if(Main::getLogLevel() !== null && !Resolver::checkLogLevel(LogLevel::VERBOSE, Main::getLogLevel())) return; - self::out(self::setPrefix(LogLevel::Verbose, $message), $newline, true); + self::out(self::setPrefix(LogLevel::VERBOSE, $message), $newline, true); } @@ -279,7 +279,7 @@ if($persist) { - return $color_code . $input . ConsoleColors::Default; + return $color_code . $input . ConsoleColors::DEFAULT; } return $color_code . $input; @@ -297,16 +297,16 @@ if(!ncc::cliMode()) return; - if(Main::getLogLevel() !== null && !Resolver::checkLogLevel(LogLevel::Warning, Main::getLogLevel())) + if(Main::getLogLevel() !== null && !Resolver::checkLogLevel(LogLevel::WARNING, Main::getLogLevel())) return; - if(Main::getLogLevel() !== null && Resolver::checkLogLevel(LogLevel::Verbose, Main::getLogLevel())) + if(Main::getLogLevel() !== null && Resolver::checkLogLevel(LogLevel::VERBOSE, Main::getLogLevel())) { - self::out(self::setPrefix(LogLevel::Warning, $message), $newline, true); + self::out(self::setPrefix(LogLevel::WARNING, $message), $newline, true); return; } - self::out(self::formatColor('Warning: ', ConsoleColors::Yellow) . $message, $newline); + self::out(self::formatColor('Warning: ', ConsoleColors::YELLOW) . $message, $newline); } /** @@ -322,16 +322,16 @@ if(!ncc::cliMode()) return; - if(Main::getLogLevel() !== null && !Resolver::checkLogLevel(LogLevel::Error, Main::getLogLevel())) + if(Main::getLogLevel() !== null && !Resolver::checkLogLevel(LogLevel::ERROR, Main::getLogLevel())) return; - if(Main::getLogLevel() !== null && Resolver::checkLogLevel(LogLevel::Verbose, Main::getLogLevel())) + if(Main::getLogLevel() !== null && Resolver::checkLogLevel(LogLevel::VERBOSE, Main::getLogLevel())) { - self::out(self::setPrefix(LogLevel::Error, $message), $newline, true); + self::out(self::setPrefix(LogLevel::ERROR, $message), $newline, true); } else { - self::out(self::formatColor(ConsoleColors::Red, 'Error: ') . $message, $newline); + self::out(self::formatColor(ConsoleColors::RED, 'Error: ') . $message, $newline); } if($exit_code !== null) @@ -353,9 +353,9 @@ if(!ncc::cliMode()) return; - if(strlen($message) > 0 && Resolver::checkLogLevel(LogLevel::Error, Main::getLogLevel())) + if(strlen($message) > 0 && Resolver::checkLogLevel(LogLevel::ERROR, Main::getLogLevel())) { - self::out(PHP_EOL . self::formatColor('Error: ', ConsoleColors::Red) . $message); + self::out(PHP_EOL . self::formatColor('Error: ', ConsoleColors::RED) . $message); } Console::out(PHP_EOL . '===== Exception Details ====='); @@ -381,8 +381,8 @@ // Exception name without namespace - $trace_header = self::formatColor($e->getFile() . ':' . $e->getLine(), ConsoleColors::Magenta); - $trace_error = self::formatColor( 'Error: ', ConsoleColors::Red); + $trace_header = self::formatColor($e->getFile() . ':' . $e->getLine(), ConsoleColors::MAGENTA); + $trace_error = self::formatColor( 'Error: ', ConsoleColors::RED); self::out($trace_header . ' ' . $trace_error . $e->getMessage()); self::out(sprintf('Exception: %s', get_class($e))); self::out(sprintf('Error code: %s', $e->getCode())); @@ -392,7 +392,7 @@ self::out('Stack Trace:'); foreach($trace as $item) { - self::out( ' - ' . self::formatColor($item['file'], ConsoleColors::Red) . ':' . $item['line']); + self::out( ' - ' . self::formatColor($item['file'], ConsoleColors::RED) . ':' . $item['line']); } } diff --git a/src/ncc/Utilities/Functions.php b/src/ncc/Utilities/Functions.php index f0ca84a..14dea3c 100644 --- a/src/ncc/Utilities/Functions.php +++ b/src/ncc/Utilities/Functions.php @@ -23,11 +23,11 @@ namespace ncc\Utilities; use Exception; - use ncc\Abstracts\AuthenticationType; - use ncc\Abstracts\DefinedRemoteSourceType; - use ncc\Abstracts\HttpRequestType; - use ncc\Abstracts\Runners; - use ncc\Abstracts\Scopes; + use ncc\Enums\AuthenticationType; + use ncc\Enums\DefinedRemoteSourceType; + use ncc\Enums\HttpRequestType; + use ncc\Enums\Runners; + use ncc\Enums\Scopes; use ncc\Classes\BashExtension\BashRunner; use ncc\Classes\GithubExtension\GithubService; use ncc\Classes\GitlabExtension\GitlabService; @@ -307,12 +307,12 @@ namespace ncc\Utilities; public static function compileRunner(string $path, ExecutionPolicy $policy): ExecutionUnit { return match (strtolower($policy->Runner)) { - Runners::bash => BashRunner::processUnit($path, $policy), - Runners::php => PhpRunner::processUnit($path, $policy), - Runners::perl => PerlRunner::processUnit($path, $policy), - Runners::python => PythonRunner::processUnit($path, $policy), - Runners::python2 => Python2Runner::processUnit($path, $policy), - Runners::python3 => Python3Runner::processUnit($path, $policy), + Runners::BASH => BashRunner::processUnit($path, $policy), + Runners::PHP => PhpRunner::processUnit($path, $policy), + Runners::PERL => PerlRunner::processUnit($path, $policy), + Runners::PYTHON => PythonRunner::processUnit($path, $policy), + Runners::PYTHON_2 => Python2Runner::processUnit($path, $policy), + Runners::PYTHON_3 => Python3Runner::processUnit($path, $policy), Runners::lua => LuaRunner::processUnit($path, $policy), default => throw new RunnerExecutionException('The runner \'' . $policy->Runner . '\' is not supported'), }; @@ -366,37 +366,37 @@ namespace ncc\Utilities; */ public static function initializeFiles(): void { - if(Resolver::resolveScope() !== Scopes::System) + if(Resolver::resolveScope() !== Scopes::SYSTEM) throw new AccessDeniedException('Cannot initialize NCC files, insufficient permissions'); Console::outVerbose('Initializing NCC files'); $filesystem = new Filesystem(); - if(!$filesystem->exists(PathFinder::getDataPath(Scopes::System))) + if(!$filesystem->exists(PathFinder::getDataPath(Scopes::SYSTEM))) { - Console::outDebug(sprintf('Initializing %s', PathFinder::getDataPath(Scopes::System))); - $filesystem->mkdir(PathFinder::getDataPath(Scopes::System), 0755); + Console::outDebug(sprintf('Initializing %s', PathFinder::getDataPath(Scopes::SYSTEM))); + $filesystem->mkdir(PathFinder::getDataPath(Scopes::SYSTEM), 0755); } - if(!$filesystem->exists(PathFinder::getCachePath(Scopes::System))) + if(!$filesystem->exists(PathFinder::getCachePath(Scopes::SYSTEM))) { - Console::outDebug(sprintf('Initializing %s', PathFinder::getCachePath(Scopes::System))); + Console::outDebug(sprintf('Initializing %s', PathFinder::getCachePath(Scopes::SYSTEM))); /** @noinspection PhpRedundantOptionalArgumentInspection */ - $filesystem->mkdir(PathFinder::getCachePath(Scopes::System), 0777); + $filesystem->mkdir(PathFinder::getCachePath(Scopes::SYSTEM), 0777); } - if(!$filesystem->exists(PathFinder::getRunnerPath(Scopes::System))) + if(!$filesystem->exists(PathFinder::getRunnerPath(Scopes::SYSTEM))) { - Console::outDebug(sprintf('Initializing %s', PathFinder::getRunnerPath(Scopes::System))); + Console::outDebug(sprintf('Initializing %s', PathFinder::getRunnerPath(Scopes::SYSTEM))); /** @noinspection PhpRedundantOptionalArgumentInspection */ - $filesystem->mkdir(PathFinder::getRunnerPath(Scopes::System), 0755); + $filesystem->mkdir(PathFinder::getRunnerPath(Scopes::SYSTEM), 0755); } - if(!$filesystem->exists(PathFinder::getPackagesPath(Scopes::System))) + if(!$filesystem->exists(PathFinder::getPackagesPath(Scopes::SYSTEM))) { - Console::outDebug(sprintf('Initializing %s', PathFinder::getPackagesPath(Scopes::System))); + Console::outDebug(sprintf('Initializing %s', PathFinder::getPackagesPath(Scopes::SYSTEM))); /** @noinspection PhpRedundantOptionalArgumentInspection */ - $filesystem->mkdir(PathFinder::getPackagesPath(Scopes::System), 0755); + $filesystem->mkdir(PathFinder::getPackagesPath(Scopes::SYSTEM), 0755); } // Create credential store if needed @@ -569,11 +569,11 @@ namespace ncc\Utilities; throw new GitlabServiceException('The given Vault entry is not decrypted.'); switch ($entry->getPassword()->getAuthenticationType()) { - case AuthenticationType::AccessToken: + case AuthenticationType::ACCESS_TOKEN: $httpRequest->Headers[] = "Authorization: Bearer " . $entry->getPassword(); break; - case AuthenticationType::UsernamePassword: + case AuthenticationType::USERNAME_PASSWORD: throw new AuthenticationException('Username/Password authentication is not supported'); } } @@ -773,11 +773,11 @@ namespace ncc\Utilities; switch($definedRemoteSource->Type) { - case DefinedRemoteSourceType::Github: + case DefinedRemoteSourceType::GITHUB: $source = GithubService::class; break; - case DefinedRemoteSourceType::Gitlab: + case DefinedRemoteSourceType::GITLAB: $source = GitlabService::class; break; @@ -967,7 +967,7 @@ namespace ncc\Utilities; */ public static function finalizePermissions(): void { - if(Resolver::resolveScope() !== Scopes::System) + if(Resolver::resolveScope() !== Scopes::SYSTEM) return; Console::outVerbose('Finalizing permissions...'); @@ -975,8 +975,8 @@ namespace ncc\Utilities; try { - if($filesystem->exists(PathFinder::getDataPath(Scopes::System))) - $filesystem->chmod(PathFinder::getDataPath(Scopes::System), 0777, 0000, true); + if($filesystem->exists(PathFinder::getDataPath(Scopes::SYSTEM))) + $filesystem->chmod(PathFinder::getDataPath(Scopes::SYSTEM), 0777, 0000, true); } catch(Exception $e) { @@ -985,8 +985,8 @@ namespace ncc\Utilities; try { - if($filesystem->exists(PathFinder::getCachePath(Scopes::System))) - $filesystem->chmod(PathFinder::getCachePath(Scopes::System), 0777, 0000, true); + if($filesystem->exists(PathFinder::getCachePath(Scopes::SYSTEM))) + $filesystem->chmod(PathFinder::getCachePath(Scopes::SYSTEM), 0777, 0000, true); } catch(Exception $e) { diff --git a/src/ncc/Utilities/PathFinder.php b/src/ncc/Utilities/PathFinder.php index 38ba883..8cf99b7 100644 --- a/src/ncc/Utilities/PathFinder.php +++ b/src/ncc/Utilities/PathFinder.php @@ -22,7 +22,7 @@ namespace ncc\Utilities; - use ncc\Abstracts\Scopes; + use ncc\Enums\Scopes; use ncc\Exceptions\InvalidPackageNameException; use ncc\Exceptions\InvalidScopeException; use ncc\Exceptions\RunnerExecutionException; @@ -67,7 +67,7 @@ namespace ncc\Utilities; * @return string * @throws InvalidScopeException */ - public static function getHomePath(string $scope=Scopes::Auto, bool $win32=false): string + public static function getHomePath(string $scope=Scopes::AUTO, bool $win32=false): string { $scope = Resolver::resolveScope($scope); @@ -80,20 +80,20 @@ namespace ncc\Utilities; { switch($scope) { - case Scopes::User: + case Scopes::USER: return self::getRootPath($win32) . 'ncc' . DIRECTORY_SEPARATOR . 'user_home'; - case Scopes::System: + case Scopes::SYSTEM: return self::getRootPath($win32) . 'ncc' . DIRECTORY_SEPARATOR . 'system_home'; } } switch($scope) { - case Scopes::User: + case Scopes::USER: $uid = posix_getuid(); return posix_getpwuid($uid)['dir'] . DIRECTORY_SEPARATOR . '.ncc'; - case Scopes::System: + case Scopes::SYSTEM: return posix_getpwuid(0)['dir'] . DIRECTORY_SEPARATOR . '.ncc'; } @@ -108,7 +108,7 @@ namespace ncc\Utilities; * @return string * @throws InvalidScopeException */ - public static function getDataPath(string $scope=Scopes::Auto, bool $win32=false): string + public static function getDataPath(string $scope=Scopes::AUTO, bool $win32=false): string { $scope = Resolver::resolveScope($scope); @@ -121,20 +121,20 @@ namespace ncc\Utilities; { switch($scope) { - case Scopes::User: + case Scopes::USER: return self::getRootPath($win32) . 'ncc' . DIRECTORY_SEPARATOR . 'user'; - case Scopes::System: + case Scopes::SYSTEM: return self::getRootPath($win32) . 'ncc' . DIRECTORY_SEPARATOR . 'system'; } } switch($scope) { - case Scopes::User: + case Scopes::USER: $uid = posix_getuid(); return posix_getpwuid($uid)['dir'] . DIRECTORY_SEPARATOR . '.ncc' . DIRECTORY_SEPARATOR . 'data'; - case Scopes::System: + case Scopes::SYSTEM: return self::getRootPath() . 'var' . DIRECTORY_SEPARATOR . 'ncc'; } @@ -149,7 +149,7 @@ namespace ncc\Utilities; * @return string * @throws InvalidScopeException */ - public static function getPackagesPath(string $scope=Scopes::Auto, bool $win32=false): string + public static function getPackagesPath(string $scope=Scopes::AUTO, bool $win32=false): string { return self::getDataPath($scope, $win32) . DIRECTORY_SEPARATOR . 'packages'; } @@ -162,7 +162,7 @@ namespace ncc\Utilities; * @return string * @throws InvalidScopeException */ - public static function getCachePath(string $scope=Scopes::Auto, bool $win32=false): string + public static function getCachePath(string $scope=Scopes::AUTO, bool $win32=false): string { return self::getDataPath($scope, $win32) . DIRECTORY_SEPARATOR . 'cache'; } @@ -175,7 +175,7 @@ namespace ncc\Utilities; * @return string * @throws InvalidScopeException */ - public static function getRunnerPath(string $scope=Scopes::Auto, bool $win32=false): string + public static function getRunnerPath(string $scope=Scopes::AUTO, bool $win32=false): string { return self::getDataPath($scope, $win32) . DIRECTORY_SEPARATOR . 'runners'; } @@ -188,7 +188,7 @@ namespace ncc\Utilities; * @return string * @throws InvalidScopeException */ - public static function getPackageLock(string $scope=Scopes::Auto, bool $win32=false): string + public static function getPackageLock(string $scope=Scopes::AUTO, bool $win32=false): string { return self::getDataPath($scope, $win32) . DIRECTORY_SEPARATOR . 'package.lck'; } @@ -199,7 +199,7 @@ namespace ncc\Utilities; * @return string * @throws InvalidScopeException */ - public static function getRemoteSources(string $scope=Scopes::Auto, bool $win32=false): string + public static function getRemoteSources(string $scope=Scopes::AUTO, bool $win32=false): string { return self::getDataPath($scope, $win32) . DIRECTORY_SEPARATOR . 'sources'; } @@ -210,7 +210,7 @@ namespace ncc\Utilities; * @return string * @throws InvalidScopeException */ - public static function getSymlinkDictionary(string $scope=Scopes::Auto, bool $win32=false): string + public static function getSymlinkDictionary(string $scope=Scopes::AUTO, bool $win32=false): string { return self::getDataPath($scope, $win32) . DIRECTORY_SEPARATOR . 'symlinks'; } @@ -225,11 +225,11 @@ namespace ncc\Utilities; public static function getPackageLockFiles(bool $win32=false): array { $results = []; - $results[] = self::getPackageLock(Scopes::System, $win32); + $results[] = self::getPackageLock(Scopes::SYSTEM, $win32); - if(!in_array(self::getPackageLock(Scopes::User, $win32), $results)) + if(!in_array(self::getPackageLock(Scopes::USER, $win32), $results)) { - $results[] = self::getPackageLock(Scopes::User, $win32); + $results[] = self::getPackageLock(Scopes::USER, $win32); } return $results; @@ -248,7 +248,7 @@ namespace ncc\Utilities; if(!Validate::packageName($package)) throw new InvalidPackageNameException($package); - return self::getDataPath(Scopes::System) . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . $package; + return self::getDataPath(Scopes::SYSTEM) . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . $package; } /** @@ -259,7 +259,7 @@ namespace ncc\Utilities; * @return string * @throws InvalidScopeException */ - public static function getExtensionPath(string $scope=Scopes::Auto, bool $win32=false): string + public static function getExtensionPath(string $scope=Scopes::AUTO, bool $win32=false): string { return self::getDataPath($scope, $win32) . DIRECTORY_SEPARATOR . 'ext'; } @@ -272,7 +272,7 @@ namespace ncc\Utilities; */ public static function getConfigurationFile(): string { - return self::getDataPath(Scopes::System) . DIRECTORY_SEPARATOR . 'ncc.yaml'; + return self::getDataPath(Scopes::SYSTEM) . DIRECTORY_SEPARATOR . 'ncc.yaml'; } /** diff --git a/src/ncc/Utilities/Resolver.php b/src/ncc/Utilities/Resolver.php index c58edab..a0eb9b5 100644 --- a/src/ncc/Utilities/Resolver.php +++ b/src/ncc/Utilities/Resolver.php @@ -24,11 +24,11 @@ namespace ncc\Utilities; - use ncc\Abstracts\BuiltinRemoteSourceType; - use ncc\Abstracts\LogLevel; - use ncc\Abstracts\ProjectType; - use ncc\Abstracts\RemoteSourceType; - use ncc\Abstracts\Scopes; + use ncc\Enums\BuiltinRemoteSourceType; + use ncc\Enums\LogLevel; + use ncc\Enums\ProjectType; + use ncc\Enums\RemoteSourceType; + use ncc\Enums\Scopes; use ncc\Managers\RemoteSourcesManager; use ncc\Objects\ProjectDetectionResults; @@ -50,7 +50,7 @@ // Set the scope to automatic if it's null if($input == null) { - $input = Scopes::Auto; + $input = Scopes::AUTO; } $input = strtoupper($input); @@ -59,22 +59,22 @@ self::$UserIdCache = posix_getuid(); // Resolve the scope if it's set to automatic - if($input == Scopes::Auto) + if($input == Scopes::AUTO) { if(self::$UserIdCache == 0) { - $input = Scopes::System; + $input = Scopes::SYSTEM; } else { - $input = Scopes::User; + $input = Scopes::USER; } } // Auto-Correct the scope if the current user ID is 0 - if($input == Scopes::User && self::$UserIdCache == 0) + if($input == Scopes::USER && self::$UserIdCache == 0) { - $input = Scopes::System; + $input = Scopes::SYSTEM; } return $input; @@ -201,68 +201,68 @@ switch($current_level) { - case LogLevel::Debug: + case LogLevel::DEBUG: $levels = [ - LogLevel::Debug, - LogLevel::Verbose, - LogLevel::Info, - LogLevel::Warning, - LogLevel::Fatal, - LogLevel::Error + LogLevel::DEBUG, + LogLevel::VERBOSE, + LogLevel::INFO, + LogLevel::WARNING, + LogLevel::FATAL, + LogLevel::ERROR ]; if(in_array($input, $levels)) return true; return false; - case LogLevel::Verbose: + case LogLevel::VERBOSE: $levels = [ - LogLevel::Verbose, - LogLevel::Info, - LogLevel::Warning, - LogLevel::Fatal, - LogLevel::Error + LogLevel::VERBOSE, + LogLevel::INFO, + LogLevel::WARNING, + LogLevel::FATAL, + LogLevel::ERROR ]; if(in_array($input, $levels)) return true; return false; - case LogLevel::Info: + case LogLevel::INFO: $levels = [ - LogLevel::Info, - LogLevel::Warning, - LogLevel::Fatal, - LogLevel::Error + LogLevel::INFO, + LogLevel::WARNING, + LogLevel::FATAL, + LogLevel::ERROR ]; if(in_array($input, $levels)) return true; return false; - case LogLevel::Warning: + case LogLevel::WARNING: $levels = [ - LogLevel::Warning, - LogLevel::Fatal, - LogLevel::Error + LogLevel::WARNING, + LogLevel::FATAL, + LogLevel::ERROR ]; if(in_array($input, $levels)) return true; return false; - case LogLevel::Error: + case LogLevel::ERROR: $levels = [ - LogLevel::Fatal, - LogLevel::Error + LogLevel::FATAL, + LogLevel::ERROR ]; if(in_array($input, $levels)) return true; return false; - case LogLevel::Fatal: - if($input == LogLevel::Fatal) + case LogLevel::FATAL: + if($input == LogLevel::FATAL) return true; return false; default: - case LogLevel::Silent: + case LogLevel::SILENT: return false; } } @@ -277,15 +277,15 @@ */ public static function detectRemoteSourceType(string $input): string { - if(in_array($input, BuiltinRemoteSourceType::All)) - return RemoteSourceType::Builtin; + if(in_array($input, BuiltinRemoteSourceType::ALL)) + return RemoteSourceType::BUILTIN; $source_manager = new RemoteSourcesManager(); $defined_source = $source_manager->getRemoteSource($input); if($defined_source == null) - return RemoteSourceType::Unknown; + return RemoteSourceType::UNKNOWN; - return RemoteSourceType::Defined; + return RemoteSourceType::DEFINED; } /** @@ -304,7 +304,7 @@ $project_file = Functions::searchDirectory($path, $project_files); $project_detection_results = new ProjectDetectionResults(); - $project_detection_results->ProjectType = ProjectType::Unknown; + $project_detection_results->ProjectType = ProjectType::UNKNOWN; if($project_file == null) { @@ -315,11 +315,11 @@ switch(basename($project_file)) { case 'project.json': - $project_detection_results->ProjectType = ProjectType::Ncc; + $project_detection_results->ProjectType = ProjectType::NCC; break; case 'composer.json': - $project_detection_results->ProjectType = ProjectType::Composer; + $project_detection_results->ProjectType = ProjectType::COMPOSER; break; } diff --git a/src/ncc/Utilities/Validate.php b/src/ncc/Utilities/Validate.php index bd619a8..b4db004 100644 --- a/src/ncc/Utilities/Validate.php +++ b/src/ncc/Utilities/Validate.php @@ -22,9 +22,9 @@ namespace ncc\Utilities; - use ncc\Abstracts\LogLevel; - use ncc\Abstracts\RegexPatterns; - use ncc\Abstracts\Scopes; + use ncc\Enums\LogLevel; + use ncc\Enums\RegexPatterns; + use ncc\Enums\Scopes; /** * @author Zi Xing Narrakas @@ -76,13 +76,13 @@ namespace ncc\Utilities; */ public static function version(string $input): bool { - if(preg_match(RegexPatterns::SemanticVersioning2, $input)) + if(preg_match(RegexPatterns::SEMANTIC_VERSIONING_2, $input)) return true; - if(preg_match(RegexPatterns::ComposerVersionFormat, $input)) + if(preg_match(RegexPatterns::COMPOSER_VERSION_FORMAT, $input)) return true; - if(preg_match(RegexPatterns::PythonVersionFormat, $input)) + if(preg_match(RegexPatterns::PYTHON_VERSION_FORMAT, $input)) return true; return false; @@ -105,8 +105,8 @@ namespace ncc\Utilities; switch($input) { - case Scopes::System: - case Scopes::User: + case Scopes::SYSTEM: + case Scopes::USER: return true; default: @@ -124,7 +124,7 @@ namespace ncc\Utilities; { $input = Resolver::resolveScope($input); - if($input == Scopes::System && posix_getuid() !== 0) + if($input == Scopes::SYSTEM && posix_getuid() !== 0) return false; return true; @@ -143,7 +143,7 @@ namespace ncc\Utilities; return false; } - if(!preg_match(RegexPatterns::PackageNameFormat, $input)) + if(!preg_match(RegexPatterns::PACKAGE_NAME_FORMAT, $input)) { return false; } @@ -185,7 +185,7 @@ namespace ncc\Utilities; */ public static function unixFilepath($input): bool { - if(preg_match(RegexPatterns::UnixPath, $input)) + if(preg_match(RegexPatterns::UNIX_PATH, $input)) { return true; } @@ -201,7 +201,7 @@ namespace ncc\Utilities; */ public static function windowsFilepath($input): bool { - if(preg_match(RegexPatterns::WindowsPath, $input)) + if(preg_match(RegexPatterns::WINDOWS_PATH, $input)) { return true; } @@ -243,7 +243,7 @@ namespace ncc\Utilities; return false; } - if(!preg_match(RegexPatterns::ExecutionPolicyName, $input)) + if(!preg_match(RegexPatterns::EXECUTION_POLICY_NAME, $input)) { return false; } @@ -259,7 +259,7 @@ namespace ncc\Utilities; */ public static function checkLogLevel(string $input): bool { - if(!in_array(strtolower($input), LogLevel::All)) + if(!in_array(strtolower($input), LogLevel::ALL)) return false; return true; diff --git a/tests/utils/pathfinder.php b/tests/utils/pathfinder.php index bc638e8..bb6dad1 100644 --- a/tests/utils/pathfinder.php +++ b/tests/utils/pathfinder.php @@ -6,70 +6,70 @@ print('Win32 Root Directory: ' . \ncc\Utilities\PathFinder::getRootPath(true) . PHP_EOL); print(PHP_EOL); - print('Unix Home Directory (Auto): ' . \ncc\Utilities\PathFinder::getHomePath(\ncc\Abstracts\Scopes::Auto, false) . PHP_EOL); - print('Unix Home Directory (User): ' . \ncc\Utilities\PathFinder::getHomePath(\ncc\Abstracts\Scopes::User, false) . PHP_EOL); - print('Unix Home Directory (System): ' . \ncc\Utilities\PathFinder::getHomePath(\ncc\Abstracts\Scopes::System, false) . PHP_EOL); - print('Win32 Home Directory (Auto): ' . \ncc\Utilities\PathFinder::getHomePath(\ncc\Abstracts\Scopes::Auto, true) . PHP_EOL); - print('Win32 Home Directory (User): ' . \ncc\Utilities\PathFinder::getHomePath(\ncc\Abstracts\Scopes::User, true) . PHP_EOL); - print('Win32 Home Directory (System): ' . \ncc\Utilities\PathFinder::getHomePath(\ncc\Abstracts\Scopes::System, true) . PHP_EOL); + print('Unix Home Directory (Auto): ' . \ncc\Utilities\PathFinder::getHomePath(\ncc\Enums\Scopes::AUTO, false) . PHP_EOL); + print('Unix Home Directory (User): ' . \ncc\Utilities\PathFinder::getHomePath(\ncc\Enums\Scopes::USER, false) . PHP_EOL); + print('Unix Home Directory (System): ' . \ncc\Utilities\PathFinder::getHomePath(\ncc\Enums\Scopes::SYSTEM, false) . PHP_EOL); + print('Win32 Home Directory (Auto): ' . \ncc\Utilities\PathFinder::getHomePath(\ncc\Enums\Scopes::AUTO, true) . PHP_EOL); + print('Win32 Home Directory (User): ' . \ncc\Utilities\PathFinder::getHomePath(\ncc\Enums\Scopes::USER, true) . PHP_EOL); + print('Win32 Home Directory (System): ' . \ncc\Utilities\PathFinder::getHomePath(\ncc\Enums\Scopes::SYSTEM, true) . PHP_EOL); print(PHP_EOL); - print('Unix Data Directory (Auto): ' . \ncc\Utilities\PathFinder::getDataPath(\ncc\Abstracts\Scopes::Auto, false) . PHP_EOL); - print('Unix Data Directory (User): ' . \ncc\Utilities\PathFinder::getDataPath(\ncc\Abstracts\Scopes::User, false) . PHP_EOL); - print('Unix Data Directory (System): ' . \ncc\Utilities\PathFinder::getDataPath(\ncc\Abstracts\Scopes::System, false) . PHP_EOL); - print('Win32 Data Directory (Auto): ' . \ncc\Utilities\PathFinder::getDataPath(\ncc\Abstracts\Scopes::Auto, true) . PHP_EOL); - print('Win32 Data Directory (User): ' . \ncc\Utilities\PathFinder::getDataPath(\ncc\Abstracts\Scopes::User, true) . PHP_EOL); - print('Win32 Data Directory (System): ' . \ncc\Utilities\PathFinder::getDataPath(\ncc\Abstracts\Scopes::System, true) . PHP_EOL); + print('Unix Data Directory (Auto): ' . \ncc\Utilities\PathFinder::getDataPath(\ncc\Enums\Scopes::AUTO, false) . PHP_EOL); + print('Unix Data Directory (User): ' . \ncc\Utilities\PathFinder::getDataPath(\ncc\Enums\Scopes::USER, false) . PHP_EOL); + print('Unix Data Directory (System): ' . \ncc\Utilities\PathFinder::getDataPath(\ncc\Enums\Scopes::SYSTEM, false) . PHP_EOL); + print('Win32 Data Directory (Auto): ' . \ncc\Utilities\PathFinder::getDataPath(\ncc\Enums\Scopes::AUTO, true) . PHP_EOL); + print('Win32 Data Directory (User): ' . \ncc\Utilities\PathFinder::getDataPath(\ncc\Enums\Scopes::USER, true) . PHP_EOL); + print('Win32 Data Directory (System): ' . \ncc\Utilities\PathFinder::getDataPath(\ncc\Enums\Scopes::SYSTEM, true) . PHP_EOL); print(PHP_EOL); - print('Unix Packages Directory (Auto): ' . \ncc\Utilities\PathFinder::getPackagesPath(\ncc\Abstracts\Scopes::Auto, false) . PHP_EOL); - print('Unix Packages Directory (User): ' . \ncc\Utilities\PathFinder::getPackagesPath(\ncc\Abstracts\Scopes::User, false) . PHP_EOL); - print('Unix Packages Directory (System): ' . \ncc\Utilities\PathFinder::getPackagesPath(\ncc\Abstracts\Scopes::System, false) . PHP_EOL); - print('Win32 Packages Directory (Auto): ' . \ncc\Utilities\PathFinder::getPackagesPath(\ncc\Abstracts\Scopes::Auto, true) . PHP_EOL); - print('Win32 Packages Directory (User): ' . \ncc\Utilities\PathFinder::getPackagesPath(\ncc\Abstracts\Scopes::User, true) . PHP_EOL); - print('Win32 Packages Directory (System): ' . \ncc\Utilities\PathFinder::getPackagesPath(\ncc\Abstracts\Scopes::System, true) . PHP_EOL); + print('Unix Packages Directory (Auto): ' . \ncc\Utilities\PathFinder::getPackagesPath(\ncc\Enums\Scopes::AUTO, false) . PHP_EOL); + print('Unix Packages Directory (User): ' . \ncc\Utilities\PathFinder::getPackagesPath(\ncc\Enums\Scopes::USER, false) . PHP_EOL); + print('Unix Packages Directory (System): ' . \ncc\Utilities\PathFinder::getPackagesPath(\ncc\Enums\Scopes::SYSTEM, false) . PHP_EOL); + print('Win32 Packages Directory (Auto): ' . \ncc\Utilities\PathFinder::getPackagesPath(\ncc\Enums\Scopes::AUTO, true) . PHP_EOL); + print('Win32 Packages Directory (User): ' . \ncc\Utilities\PathFinder::getPackagesPath(\ncc\Enums\Scopes::USER, true) . PHP_EOL); + print('Win32 Packages Directory (System): ' . \ncc\Utilities\PathFinder::getPackagesPath(\ncc\Enums\Scopes::SYSTEM, true) . PHP_EOL); print(PHP_EOL); - print('Unix Cache Directory (Auto): ' . \ncc\Utilities\PathFinder::getCachePath(\ncc\Abstracts\Scopes::Auto, false) . PHP_EOL); - print('Unix Cache Directory (User): ' . \ncc\Utilities\PathFinder::getCachePath(\ncc\Abstracts\Scopes::User, false) . PHP_EOL); - print('Unix Cache Directory (System): ' . \ncc\Utilities\PathFinder::getCachePath(\ncc\Abstracts\Scopes::System, false) . PHP_EOL); - print('Win32 Cache Directory (Auto): ' . \ncc\Utilities\PathFinder::getCachePath(\ncc\Abstracts\Scopes::Auto, true) . PHP_EOL); - print('Win32 Cache Directory (User): ' . \ncc\Utilities\PathFinder::getCachePath(\ncc\Abstracts\Scopes::User, true) . PHP_EOL); - print('Win32 Cache Directory (System): ' . \ncc\Utilities\PathFinder::getCachePath(\ncc\Abstracts\Scopes::System, true) . PHP_EOL); + print('Unix Cache Directory (Auto): ' . \ncc\Utilities\PathFinder::getCachePath(\ncc\Enums\Scopes::AUTO, false) . PHP_EOL); + print('Unix Cache Directory (User): ' . \ncc\Utilities\PathFinder::getCachePath(\ncc\Enums\Scopes::USER, false) . PHP_EOL); + print('Unix Cache Directory (System): ' . \ncc\Utilities\PathFinder::getCachePath(\ncc\Enums\Scopes::SYSTEM, false) . PHP_EOL); + print('Win32 Cache Directory (Auto): ' . \ncc\Utilities\PathFinder::getCachePath(\ncc\Enums\Scopes::AUTO, true) . PHP_EOL); + print('Win32 Cache Directory (User): ' . \ncc\Utilities\PathFinder::getCachePath(\ncc\Enums\Scopes::USER, true) . PHP_EOL); + print('Win32 Cache Directory (System): ' . \ncc\Utilities\PathFinder::getCachePath(\ncc\Enums\Scopes::SYSTEM, true) . PHP_EOL); print(PHP_EOL); - print('Unix Tmp Directory (Auto): ' . \ncc\Utilities\PathFinder::getTmpPath(\ncc\Abstracts\Scopes::Auto, false) . PHP_EOL); - print('Unix Tmp Directory (User): ' . \ncc\Utilities\PathFinder::getTmpPath(\ncc\Abstracts\Scopes::User, false) . PHP_EOL); - print('Unix Tmp Directory (System): ' . \ncc\Utilities\PathFinder::getTmpPath(\ncc\Abstracts\Scopes::System, false) . PHP_EOL); - print('Win32 Tmp Directory (Auto): ' . \ncc\Utilities\PathFinder::getTmpPath(\ncc\Abstracts\Scopes::Auto, true) . PHP_EOL); - print('Win32 Tmp Directory (User): ' . \ncc\Utilities\PathFinder::getTmpPath(\ncc\Abstracts\Scopes::User, true) . PHP_EOL); - print('Win32 Tmp Directory (System): ' . \ncc\Utilities\PathFinder::getTmpPath(\ncc\Abstracts\Scopes::System, true) . PHP_EOL); + print('Unix Tmp Directory (Auto): ' . \ncc\Utilities\PathFinder::getTmpPath(\ncc\Enums\Scopes::AUTO, false) . PHP_EOL); + print('Unix Tmp Directory (User): ' . \ncc\Utilities\PathFinder::getTmpPath(\ncc\Enums\Scopes::USER, false) . PHP_EOL); + print('Unix Tmp Directory (System): ' . \ncc\Utilities\PathFinder::getTmpPath(\ncc\Enums\Scopes::SYSTEM, false) . PHP_EOL); + print('Win32 Tmp Directory (Auto): ' . \ncc\Utilities\PathFinder::getTmpPath(\ncc\Enums\Scopes::AUTO, true) . PHP_EOL); + print('Win32 Tmp Directory (User): ' . \ncc\Utilities\PathFinder::getTmpPath(\ncc\Enums\Scopes::USER, true) . PHP_EOL); + print('Win32 Tmp Directory (System): ' . \ncc\Utilities\PathFinder::getTmpPath(\ncc\Enums\Scopes::SYSTEM, true) . PHP_EOL); print(PHP_EOL); - print('Unix Extension Directory (Auto): ' . \ncc\Utilities\PathFinder::getExtensionPath(\ncc\Abstracts\Scopes::Auto, false) . PHP_EOL); - print('Unix Extension Directory (User): ' . \ncc\Utilities\PathFinder::getExtensionPath(\ncc\Abstracts\Scopes::User, false) . PHP_EOL); - print('Unix Extension Directory (System): ' . \ncc\Utilities\PathFinder::getExtensionPath(\ncc\Abstracts\Scopes::System, false) . PHP_EOL); - print('Win32 Extension Directory (Auto): ' . \ncc\Utilities\PathFinder::getExtensionPath(\ncc\Abstracts\Scopes::Auto, true) . PHP_EOL); - print('Win32 Extension Directory (User): ' . \ncc\Utilities\PathFinder::getExtensionPath(\ncc\Abstracts\Scopes::User, true) . PHP_EOL); - print('Win32 Extension Directory (System): ' . \ncc\Utilities\PathFinder::getExtensionPath(\ncc\Abstracts\Scopes::System, true) . PHP_EOL); + print('Unix Extension Directory (Auto): ' . \ncc\Utilities\PathFinder::getExtensionPath(\ncc\Enums\Scopes::AUTO, false) . PHP_EOL); + print('Unix Extension Directory (User): ' . \ncc\Utilities\PathFinder::getExtensionPath(\ncc\Enums\Scopes::USER, false) . PHP_EOL); + print('Unix Extension Directory (System): ' . \ncc\Utilities\PathFinder::getExtensionPath(\ncc\Enums\Scopes::SYSTEM, false) . PHP_EOL); + print('Win32 Extension Directory (Auto): ' . \ncc\Utilities\PathFinder::getExtensionPath(\ncc\Enums\Scopes::AUTO, true) . PHP_EOL); + print('Win32 Extension Directory (User): ' . \ncc\Utilities\PathFinder::getExtensionPath(\ncc\Enums\Scopes::USER, true) . PHP_EOL); + print('Win32 Extension Directory (System): ' . \ncc\Utilities\PathFinder::getExtensionPath(\ncc\Enums\Scopes::SYSTEM, true) . PHP_EOL); print(PHP_EOL); - print('Unix Configuration File (Auto): ' . \ncc\Utilities\PathFinder::getConfigurationFile(\ncc\Abstracts\Scopes::Auto, false) . PHP_EOL); - print('Unix Configuration File (User): ' . \ncc\Utilities\PathFinder::getConfigurationFile(\ncc\Abstracts\Scopes::User, false) . PHP_EOL); - print('Unix Configuration File (System): ' . \ncc\Utilities\PathFinder::getConfigurationFile(\ncc\Abstracts\Scopes::System, false) . PHP_EOL); + print('Unix Configuration File (Auto): ' . \ncc\Utilities\PathFinder::getConfigurationFile(\ncc\Enums\Scopes::AUTO, false) . PHP_EOL); + print('Unix Configuration File (User): ' . \ncc\Utilities\PathFinder::getConfigurationFile(\ncc\Enums\Scopes::USER, false) . PHP_EOL); + print('Unix Configuration File (System): ' . \ncc\Utilities\PathFinder::getConfigurationFile(\ncc\Enums\Scopes::SYSTEM, false) . PHP_EOL); print('Unix Configuration File(s): ' . json_encode(\ncc\Utilities\PathFinder::getConfigurationFiles(false), JSON_UNESCAPED_SLASHES) . PHP_EOL); - print('Win32 Configuration File (Auto): ' . \ncc\Utilities\PathFinder::getConfigurationFile(\ncc\Abstracts\Scopes::Auto, true) . PHP_EOL); - print('Win32 Configuration File (User): ' . \ncc\Utilities\PathFinder::getConfigurationFile(\ncc\Abstracts\Scopes::User, true) . PHP_EOL); - print('Win32 Configuration File (System): ' . \ncc\Utilities\PathFinder::getConfigurationFile(\ncc\Abstracts\Scopes::System, true) . PHP_EOL); + print('Win32 Configuration File (Auto): ' . \ncc\Utilities\PathFinder::getConfigurationFile(\ncc\Enums\Scopes::AUTO, true) . PHP_EOL); + print('Win32 Configuration File (User): ' . \ncc\Utilities\PathFinder::getConfigurationFile(\ncc\Enums\Scopes::USER, true) . PHP_EOL); + print('Win32 Configuration File (System): ' . \ncc\Utilities\PathFinder::getConfigurationFile(\ncc\Enums\Scopes::SYSTEM, true) . PHP_EOL); print('Win32 Configuration File(s): ' . json_encode(\ncc\Utilities\PathFinder::getConfigurationFiles(true), JSON_UNESCAPED_SLASHES) . PHP_EOL); print(PHP_EOL); - print('Unix Package Lock (Auto): ' . \ncc\Utilities\PathFinder::getPackageLock(\ncc\Abstracts\Scopes::Auto, false) . PHP_EOL); - print('Unix Package Lock (User): ' . \ncc\Utilities\PathFinder::getPackageLock(\ncc\Abstracts\Scopes::User, false) . PHP_EOL); - print('Unix Package Lock (System): ' . \ncc\Utilities\PathFinder::getPackageLock(\ncc\Abstracts\Scopes::System, false) . PHP_EOL); + print('Unix Package Lock (Auto): ' . \ncc\Utilities\PathFinder::getPackageLock(\ncc\Enums\Scopes::AUTO, false) . PHP_EOL); + print('Unix Package Lock (User): ' . \ncc\Utilities\PathFinder::getPackageLock(\ncc\Enums\Scopes::USER, false) . PHP_EOL); + print('Unix Package Lock (System): ' . \ncc\Utilities\PathFinder::getPackageLock(\ncc\Enums\Scopes::SYSTEM, false) . PHP_EOL); print('Unix Package Lock(s): ' . json_encode(\ncc\Utilities\PathFinder::getPackageLockFiles(false), JSON_UNESCAPED_SLASHES) . PHP_EOL); - print('Win32 Package Lock (Auto): ' . \ncc\Utilities\PathFinder::getPackageLock(\ncc\Abstracts\Scopes::Auto, true) . PHP_EOL); - print('Win32 Package Lock (User): ' . \ncc\Utilities\PathFinder::getPackageLock(\ncc\Abstracts\Scopes::User, true) . PHP_EOL); - print('Win32 Package Lock (System): ' . \ncc\Utilities\PathFinder::getPackageLock(\ncc\Abstracts\Scopes::System, true) . PHP_EOL); + print('Win32 Package Lock (Auto): ' . \ncc\Utilities\PathFinder::getPackageLock(\ncc\Enums\Scopes::AUTO, true) . PHP_EOL); + print('Win32 Package Lock (User): ' . \ncc\Utilities\PathFinder::getPackageLock(\ncc\Enums\Scopes::USER, true) . PHP_EOL); + print('Win32 Package Lock (System): ' . \ncc\Utilities\PathFinder::getPackageLock(\ncc\Enums\Scopes::SYSTEM, true) . PHP_EOL); print('Win32 Package Lock(s): ' . json_encode(\ncc\Utilities\PathFinder::getPackageLockFiles(true), JSON_UNESCAPED_SLASHES) . PHP_EOL); print(PHP_EOL); \ No newline at end of file