- 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`
This commit is contained in:
Netkas 2023-08-18 00:22:15 -04:00
parent 3afcb731fe
commit 8e44a8c7c9
No known key found for this signature in database
GPG key ID: 5DAF58535614062B
156 changed files with 1388 additions and 1364 deletions

View file

@ -1,3 +1,3 @@
<component name="DependencyValidationManager"> <component name="DependencyValidationManager">
<scope name="NCC Source files" pattern="file[ncc]:src/ncc/Managers//*||file[ncc]:src/ncc/Abstracts//*||file[ncc]:src/ncc/Exceptions//*||file[ncc]:src/ncc/Runtime//*||file[ncc]:src/ncc/Extensions//*||file[ncc]:src/ncc/CLI//*||file[ncc]:src/ncc/Classes//*||file[ncc]:src/ncc/Objects//*||file[ncc]:src/ncc/Interfaces//*||file[ncc]:src/ncc/Utilities//*||file:src/ncc/ncc.php||file:src/ncc/ncc||file:src/ncc/banner_basic||file:src/ncc/autoload_spl.php||file:src/ncc/autoload.php||file:src/ncc/Runtime.php" /> <scope name="NCC Source files" pattern="file[ncc]:src/ncc/Managers//*||file[ncc]:src/ncc/Enums//*||file[ncc]:src/ncc/Exceptions//*||file[ncc]:src/ncc/Runtime//*||file[ncc]:src/ncc/Extensions//*||file[ncc]:src/ncc/CLI//*||file[ncc]:src/ncc/Classes//*||file[ncc]:src/ncc/Objects//*||file[ncc]:src/ncc/Interfaces//*||file[ncc]:src/ncc/Utilities//*||file:src/ncc/ncc.php||file:src/ncc/ncc||file:src/ncc/banner_basic||file:src/ncc/autoload_spl.php||file:src/ncc/autoload.php||file:src/ncc/Runtime.php" />
</component> </component>

View file

@ -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 > GithubExtension > GithubService`
- Corrected code-smell and code style issues in `\ncc\Classes > GitlabExtension > GitlabService` - Corrected code-smell and code style issues in `\ncc\Classes > GitlabExtension > GitlabService`
- Corrected code-smell and code style issues in `\ncc\Classes > NccExtension > ConstantCompiler` - 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 ncc will display a warning if TTY mode cannot be enabled
## [1.0.2] - 2023-06-29 ## [1.0.2] - 2023-06-29
### Fixed ### Fixed
@ -58,6 +90,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
- Dockerfile for building a docker image of NCC - Dockerfile for building a docker image of NCC
## [1.0.1] - 2023-02-07 ## [1.0.1] - 2023-02-07
### Added ### Added
@ -74,6 +108,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- File downloads now cache the URL as a pointer to the file reducing the number of times the same file is downloaded - 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 ## [1.0.0] - 2022-01-29
### Added ### Added

View file

@ -12,7 +12,7 @@
<?PHP <?PHP
use ncc\Abstracts\ConsoleColors; use ncc\Enums\ConsoleColors;
use ncc\Exceptions\FileNotFoundException; use ncc\Exceptions\FileNotFoundException;
use ncc\Managers\RemoteSourcesManager; use ncc\Managers\RemoteSourcesManager;
use ncc\ncc; use ncc\ncc;
@ -249,11 +249,11 @@
{ {
if($installed) if($installed)
{ {
Console::out("$ext ... " . Console::formatColor("installed", ConsoleColors::LightGreen)); Console::out("$ext ... " . Console::formatColor("installed", ConsoleColors::LIGHT_GREEN));
} }
else else
{ {
Console::out("$ext ... " . Console::formatColor("missing", ConsoleColors::LightRed)); Console::out("$ext ... " . Console::formatColor("missing", ConsoleColors::LIGHT_RED));
} }
} }
@ -295,11 +295,11 @@
try try
{ {
Console::out(Console::formatColor($full_name, ConsoleColors::Green) . ' Version: ' . Console::formatColor($component->getVersion(), ConsoleColors::LightMagenta)); Console::out(Console::formatColor($full_name, ConsoleColors::GREEN) . ' Version: ' . Console::formatColor($component->getVersion(), ConsoleColors::LIGHT_MAGENTA));
} }
catch (Exception $e) 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));
} }
} }

View file

@ -1,449 +0,0 @@
<?php
/*
* Copyright (c) Nosial 2022-2023, all rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction, including without
* limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
* Software, and to permit persons to whom the Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace ncc\Abstracts;
use ncc\Exceptions\SymlinkException;
/**
* @author Zi Xing Narrakas
* @copyright Copyright (C) 2022-2022. Nosial - All Rights Reserved.
*/
abstract class ExceptionCodes
{
/**
* @see InvalidProjectConfigurationException
*/
const InvalidProjectConfigurationException = -1700;
/**
* @see FileNotFoundException;
*/
const FileNotFoundException = -1701;
/**
* @see DirectoryNotFoundException
*/
const DirectoryNotFoundException = -1702;
/**
* @see InvalidScopeException
*/
const InvalidScopeException = -1703;
/**
* @see AccessDeniedException
*/
const AccessDeniedException = -1704;
/**
* @see MalformedJsonException
*/
const MalformedJsonException = -1705;
/**
* @see RuntimeException
*/
const RuntimeException = -1706;
/**
* @see InvalidCredentialsEntryException
*/
const InvalidCredentialsEntryException = -1707;
/**
* @see ComponentVersionNotFoundException
*/
const ComponentVersionNotFoundException = -1708;
/**
* @see ConstantReadonlyException
*/
const ConstantReadonlyException = -1709;
/**
* @see InvalidPackageNameException
*/
const InvalidPackageNameException = -1710;
/**
* @see InvalidVersionNumberException
*/
const InvalidVersionNumberException = -1711;
/**
* @see InvalidProjectNameException
*/
const InvalidProjectNameException = -1712;
/**
* @see ProjectAlreadyExistsException
*/
const ProjectAlreadyExistsException = -1713;
/**
* @see AutoloadGeneratorException
*/
const AutoloadGeneratorException = -1714;
/**
* @see NoUnitsFoundException
*/
const NoUnitsFoundException = -1715;
/**
* @see UnsupportedPackageException
*/
const UnsupportedPackageException = -1716;
/**
* @see NotImplementedException
*/
const NotImplementedException = -1717;
/**
* @see InvalidPackageException
*/
const InvalidPackageException = -1718;
/**
* @see InvalidConstantNameException
*/
const InvalidConstantNameException = -1719;
/**
* @see PackagePreparationFailedException
*/
const PackagePreparationFailedException = -1720;
/**
* @see BuildConfigurationNotFoundException
*/
const BuildConfigurationNotFoundException = -1721;
/**
* @see InvalidProjectBuildConfiguration
*/
const InvalidProjectBuildConfiguration = -1722;
/**
* @see UnsupportedCompilerExtensionException
*/
const UnsupportedCompilerExtensionException = -1723;
/**
* @see InvalidPropertyValueException
*/
const InvalidPropertyValueException = -1724;
/**
* @see InvalidVersionConfigurationException
*/
const InvalidVersionConfigurationException = -1725;
/**
* @see UnsupportedExtensionVersionException
*/
const UnsupportedExtensionVersionException = -1726;
/**
* @see BuildException
*/
const BuildException = -1727;
/**
* @see PackageParsingException
*/
const PackageParsingException = -1728;
/**
* @see PackageLockException
*/
const PackageLockException = -1729;
/**
* @see InstallationException
*/
const InstallationException = -1730;
/**
* @see UnsupportedComponentTypeException
*/
const UnsupportedComponentTypeException = -1731;
/**
* @see ComponentDecodeException
*/
const ComponentDecodeException = -1732;
/**
* @see ComponentChecksumException
*/
const ComponentChecksumException = -1733;
/**
* @see ResourceChecksumException
*/
const ResourceChecksumException = -1734;
/**
* @see IOException
*/
const IOException = -1735;
/**
* @see UnsupportedRunnerException
*/
const UnsupportedRunnerException = -1736;
/**
* @see VersionNotFoundException
*/
const VersionNotFoundException = -1737;
/**
* @see UndefinedExecutionPolicyException
*/
const UndefinedExecutionPolicyException = -1738;
/**
* @see InvalidExecutionPolicyName
*/
const InvalidExecutionPolicyName = -1739;
/**
* @see ProjectConfigurationNotFoundException
*/
const ProjectConfigurationNotFoundException = -1740;
/**
* @see RunnerExecutionException
*/
const RunnerExecutionException = -1741;
/**
* @see NoAvailableUnitsException
*/
const NoAvailableUnitsException = -1742;
/**
* @see ExecutionUnitNotFoundException
*/
const ExecutionUnitNotFoundException = -1743;
/**
* @see PackageAlreadyInstalledException
*/
const PackageAlreadyInstalledException = -1744;
/**
* @see PackageNotFoundException
*/
const PackageNotFoundException = -1745;
/**
* @see ComposerDisabledException
*/
const ComposerDisabledException = -1746;
/**
* @see InternalComposerNotAvailableException
*/
const InternalComposerNotAvailable = -1747;
/**
* @see ComposerNotAvailableException
*/
const ComposerNotAvailableException = -1748;
/**
* @see ComposerException
*/
const ComposerException = -1749;
/**
* @see UserAbortedOperationException
*/
const UserAbortedOperationException = -1750;
/**
* @see MissingDependencyException
*/
const MissingDependencyException = -1751;
/**
* @see HttpException
*/
const HttpException = -1752;
/**
* @see UnsupportedRemoteSourceTypeException
*/
const UnsupportedRemoteSourceTypeException = -1753;
/**
* @see GitCloneException
*/
const GitCloneException = -1754;
/**
* @see GitCheckoutException
*/
const GitCheckoutException = -1755;
/**
* @see GitlabServiceException
*/
const GitlabServiceException = -1756;
/**
* @see ImportException
*/
const ImportException = -1757;
/**
* @see GitTagsException
*/
const GitTagsException = -1758;
/**
* @see GithubServiceException
*/
const GithubServiceException = -1759;
/**
* @see AuthenticationException
*/
const AuthenticationException = -1760;
/**
* @see NotSupportedException
*/
const NotSupportedException = -1761;
/**
* @see UnsupportedProjectTypeException
*/
const UnsupportedProjectTypeException = -1762;
/**
* @see UnsupportedArchiveException
*/
const UnsupportedArchiveException = -1763;
/**
* @see ArchiveException
*/
const ArchiveException = -1764;
/**
* @see PackageFetchException
*/
const PackageFetchException = -1765;
/**
* @see InvalidBuildConfigurationException
*/
const InvalidBuildConfigurationException = -1766;
/**
* @see InvalidBuildConfigurationNameException
*/
const InvalidDependencyConfiguration = -1767;
/**
* @see SymlinkException
*/
const SymlinkException = -1768;
/**
* All the exception codes from NCC
*/
const All = [
self::InvalidProjectConfigurationException,
self::FileNotFoundException,
self::DirectoryNotFoundException,
self::InvalidScopeException,
self::AccessDeniedException,
self::MalformedJsonException,
self::RuntimeException,
self::InvalidCredentialsEntryException,
self::ComponentVersionNotFoundException,
self::ConstantReadonlyException,
self::InvalidPackageNameException,
self::InvalidVersionNumberException,
self::InvalidProjectNameException,
self::ProjectAlreadyExistsException,
self::AutoloadGeneratorException,
self::NoUnitsFoundException,
self::UnsupportedPackageException,
self::NotImplementedException,
self::InvalidPackageException,
self::InvalidConstantNameException,
self::PackagePreparationFailedException,
self::BuildConfigurationNotFoundException,
self::InvalidProjectBuildConfiguration,
self::UnsupportedCompilerExtensionException,
self::InvalidPropertyValueException,
self::InvalidVersionConfigurationException,
self::UnsupportedExtensionVersionException,
self::BuildException,
self::PackageParsingException,
self::PackageLockException,
self::InstallationException,
self::UnsupportedComponentTypeException,
self::ComponentDecodeException,
self::ResourceChecksumException,
self::IOException,
self::UnsupportedRunnerException,
self::VersionNotFoundException,
self::UndefinedExecutionPolicyException,
self::InvalidExecutionPolicyName,
self::ProjectConfigurationNotFoundException,
self::RunnerExecutionException,
self::NoAvailableUnitsException,
self::ExecutionUnitNotFoundException,
self::PackageAlreadyInstalledException,
self::PackageNotFoundException,
self::ComposerDisabledException,
self::InternalComposerNotAvailable,
self::ComposerNotAvailableException,
self::ComposerException,
self::UserAbortedOperationException,
self::MissingDependencyException,
self::HttpException,
self::UnsupportedRemoteSourceTypeException,
self::GitCloneException,
self::GitCheckoutException,
self::GitlabServiceException,
self::GitTagsException,
self::AuthenticationException,
self::NotSupportedException,
self::UnsupportedProjectTypeException,
self::UnsupportedArchiveException,
self::ArchiveException,
self::PackageFetchException,
self::InvalidBuildConfigurationException,
self::InvalidDependencyConfiguration,
self::SymlinkException,
];
}

View file

@ -23,7 +23,7 @@
namespace ncc\CLI\Commands; namespace ncc\CLI\Commands;
use Exception; use Exception;
use ncc\Abstracts\Options\BuildConfigurationValues; use ncc\Enums\Options\BuildConfigurationValues;
use ncc\Managers\ProjectManager; use ncc\Managers\ProjectManager;
use ncc\Objects\CliHelpSection; use ncc\Objects\CliHelpSection;
use ncc\Utilities\Console; use ncc\Utilities\Console;
@ -91,7 +91,7 @@ namespace ncc\CLI\Commands;
// Build the project // Build the project
try try
{ {
$build_configuration = BuildConfigurationValues::DefaultConfiguration; $build_configuration = BuildConfigurationValues::DEFAULT;
if(isset($args['config'])) if(isset($args['config']))
{ {
$build_configuration = $args['config']; $build_configuration = $args['config'];

View file

@ -25,8 +25,8 @@
namespace ncc\CLI; namespace ncc\CLI;
use Exception; use Exception;
use ncc\Abstracts\LogLevel; use ncc\Enums\LogLevel;
use ncc\Abstracts\NccBuildFlags; use ncc\Enums\NccBuildFlags;
use ncc\CLI\Commands\BuildCommand; use ncc\CLI\Commands\BuildCommand;
use ncc\CLI\Commands\ExecCommand; use ncc\CLI\Commands\ExecCommand;
use ncc\CLI\Management\ConfigMenu; use ncc\CLI\Management\ConfigMenu;
@ -92,35 +92,35 @@
{ {
switch(strtolower(self::$args['l'] ?? self::$args['log-level'])) switch(strtolower(self::$args['l'] ?? self::$args['log-level']))
{ {
case LogLevel::Silent: case LogLevel::SILENT:
case LogLevel::Fatal: case LogLevel::FATAL:
case LogLevel::Error: case LogLevel::ERROR:
case LogLevel::Warning: case LogLevel::WARNING:
case LogLevel::Info: case LogLevel::INFO:
case LogLevel::Debug: case LogLevel::DEBUG:
case LogLevel::Verbose: case LogLevel::VERBOSE:
self::$log_level = strtolower(self::$args['l'] ?? self::$args['log-level']); self::$log_level = strtolower(self::$args['l'] ?? self::$args['log-level']);
break; break;
default: default:
Console::outWarning('Unknown log level: ' . (self::$args['l'] ?? self::$args['log-level']) . ', using \'info\''); Console::outWarning('Unknown log level: ' . (self::$args['l'] ?? self::$args['log-level']) . ', using \'info\'');
self::$log_level = LogLevel::Info; self::$log_level = LogLevel::INFO;
break; break;
} }
} }
else else
{ {
self::$log_level = LogLevel::Info; self::$log_level = LogLevel::INFO;
} }
if(Resolver::checkLogLevel(self::$log_level, LogLevel::Debug)) if(Resolver::checkLogLevel(self::$log_level, LogLevel::DEBUG))
{ {
Console::outDebug('Debug logging enabled'); Console::outDebug('Debug logging enabled');
Console::outDebug(sprintf('const: %s', json_encode(ncc::getConstants(), JSON_UNESCAPED_SLASHES))); Console::outDebug(sprintf('const: %s', json_encode(ncc::getConstants(), JSON_UNESCAPED_SLASHES)));
Console::outDebug(sprintf('args: %s', json_encode(self::$args, JSON_UNESCAPED_SLASHES))); Console::outDebug(sprintf('args: %s', json_encode(self::$args, JSON_UNESCAPED_SLASHES)));
} }
if(in_array(NccBuildFlags::Unstable, NCC_VERSION_FLAGS)) if(in_array(NccBuildFlags::UNSTABLE, NCC_VERSION_FLAGS))
{ {
Console::outWarning('This is an unstable build of NCC, expect some features to not work as expected'); Console::outWarning('This is an unstable build of NCC, expect some features to not work as expected');
} }
@ -218,7 +218,7 @@
public static function getLogLevel(): string public static function getLogLevel(): string
{ {
if(self::$log_level == null) if(self::$log_level == null)
self::$log_level = LogLevel::Info; self::$log_level = LogLevel::INFO;
return self::$log_level; return self::$log_level;
} }

View file

@ -22,7 +22,7 @@
namespace ncc\CLI\Management; namespace ncc\CLI\Management;
use ncc\Abstracts\Scopes; use ncc\Enums\Scopes;
use ncc\Exceptions\AccessDeniedException; use ncc\Exceptions\AccessDeniedException;
use ncc\Exceptions\InvalidScopeException; use ncc\Exceptions\InvalidScopeException;
use ncc\Exceptions\IOException; use ncc\Exceptions\IOException;
@ -101,7 +101,7 @@ namespace ncc\CLI\Management;
if(isset($args['v'])) if(isset($args['v']))
{ {
if(Resolver::resolveScope() !== Scopes::System) if(Resolver::resolveScope() !== Scopes::SYSTEM)
{ {
Console::outError('Insufficient permissions, cannot modify configuration values', true, 1); Console::outError('Insufficient permissions, cannot modify configuration values', true, 1);
return; return;

View file

@ -23,7 +23,7 @@
namespace ncc\CLI\Management; namespace ncc\CLI\Management;
use Exception; use Exception;
use ncc\Abstracts\Scopes; use ncc\Enums\Scopes;
use ncc\Exceptions\RuntimeException; use ncc\Exceptions\RuntimeException;
use ncc\Managers\CredentialManager; use ncc\Managers\CredentialManager;
use ncc\Objects\CliHelpSection; use ncc\Objects\CliHelpSection;
@ -201,7 +201,7 @@ namespace ncc\CLI\Management;
{ {
$ResolvedScope = Resolver::resolveScope(); $ResolvedScope = Resolver::resolveScope();
if($ResolvedScope !== Scopes::System) if($ResolvedScope !== Scopes::SYSTEM)
Console::outError('Insufficient permissions to add entries'); Console::outError('Insufficient permissions to add entries');
// Really dumb-proofing this // Really dumb-proofing this
@ -319,7 +319,7 @@ namespace ncc\CLI\Management;
{ {
$ResolvedScope = Resolver::resolveScope(); $ResolvedScope = Resolver::resolveScope();
if($ResolvedScope !== Scopes::System) if($ResolvedScope !== Scopes::SYSTEM)
Console::outError('Insufficient permissions to remove entries'); Console::outError('Insufficient permissions to remove entries');
$name = $args['alias'] ?? $args['name'] ?? null; $name = $args['alias'] ?? $args['name'] ?? null;

View file

@ -23,9 +23,9 @@
namespace ncc\CLI\Management; namespace ncc\CLI\Management;
use Exception; use Exception;
use ncc\Abstracts\ConsoleColors; use ncc\Enums\ConsoleColors;
use ncc\Abstracts\Options\InstallPackageOptions; use ncc\Enums\Options\InstallPackageOptions;
use ncc\Abstracts\Scopes; use ncc\Enums\Scopes;
use ncc\Exceptions\FileNotFoundException; use ncc\Exceptions\FileNotFoundException;
use ncc\Exceptions\PackageLockException; use ncc\Exceptions\PackageLockException;
use ncc\Exceptions\RuntimeException; use ncc\Exceptions\RuntimeException;
@ -133,9 +133,9 @@ namespace ncc\CLI\Management;
private static function printTree($data, string $prefix=''): void private static function printTree($data, string $prefix=''): void
{ {
$symbols = [ $symbols = [
'corner' => Console::formatColor(' └─', ConsoleColors::LightRed), 'corner' => Console::formatColor(' └─', ConsoleColors::LIGHT_RED),
'line' => Console::formatColor(' │ ', ConsoleColors::LightRed), 'line' => Console::formatColor(' │ ', ConsoleColors::LIGHT_RED),
'cross' => Console::formatColor(' ├─', ConsoleColors::LightRed), 'cross' => Console::formatColor(' ├─', ConsoleColors::LIGHT_RED),
]; ];
$keys = array_keys($data); $keys = array_keys($data);
@ -278,8 +278,8 @@ namespace ncc\CLI\Management;
continue; continue;
Console::out(sprintf('%s=%s (%s)', Console::out(sprintf('%s=%s (%s)',
Console::formatColor($package, ConsoleColors::LightGreen), Console::formatColor($package, ConsoleColors::LIGHT_GREEN),
Console::formatColor($version, ConsoleColors::LightMagenta), Console::formatColor($version, ConsoleColors::LIGHT_MAGENTA),
$package_manager->getPackageVersion($package, $version)->Compiler->Extension $package_manager->getPackageVersion($package, $version)->Compiler->Extension
)); ));
} }
@ -287,9 +287,9 @@ namespace ncc\CLI\Management;
{ {
unset($e); unset($e);
Console::out(sprintf('%s=%s (%s)', Console::out(sprintf('%s=%s (%s)',
Console::formatColor($package, ConsoleColors::LightGreen), Console::formatColor($package, ConsoleColors::LIGHT_GREEN),
Console::formatColor($version, ConsoleColors::LightMagenta), Console::formatColor($version, ConsoleColors::LIGHT_MAGENTA),
Console::formatColor('N/A', ConsoleColors::LightRed) Console::formatColor('N/A', ConsoleColors::LIGHT_RED)
)); ));
} }
} }
@ -307,7 +307,7 @@ namespace ncc\CLI\Management;
$package = ($args['package'] ?? $args['p']); $package = ($args['package'] ?? $args['p']);
$package_manager = new PackageManager(); $package_manager = new PackageManager();
if(Resolver::resolveScope() !== Scopes::System) if(Resolver::resolveScope() !== Scopes::SYSTEM)
{ {
Console::outError('Insufficient permissions to install packages', true, 1); Console::outError('Insufficient permissions to install packages', true, 1);
return; return;
@ -389,12 +389,12 @@ namespace ncc\CLI\Management;
if((Functions::cbool($args['skip-dependencies'] ?? false))) if((Functions::cbool($args['skip-dependencies'] ?? false)))
{ {
$installer_options[] = InstallPackageOptions::SkipDependencies; $installer_options[] = InstallPackageOptions::SKIP_DEPENDENCIES;
} }
if(Functions::cbool($args['reinstall'] ?? false)) if(Functions::cbool($args['reinstall'] ?? false))
{ {
$installer_options[] = InstallPackageOptions::Reinstall; $installer_options[] = InstallPackageOptions::REINSTALL;
} }
try try
@ -409,23 +409,23 @@ namespace ncc\CLI\Management;
Console::out('Package installation details' . PHP_EOL); Console::out('Package installation details' . PHP_EOL);
if(!is_null($package->Assembly->UUID)) 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)) 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)) 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)) 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)) 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)) 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)) 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)) 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)) 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); Console::out((string)null);
if(count($package->Dependencies) > 0) if(count($package->Dependencies) > 0)
@ -435,7 +435,7 @@ namespace ncc\CLI\Management;
{ {
$require_dependency = false; $require_dependency = false;
if(!in_array(InstallPackageOptions::SkipDependencies, $installer_options)) if(!in_array(InstallPackageOptions::SKIP_DEPENDENCIES, $installer_options))
{ {
try try
{ {
@ -467,8 +467,8 @@ namespace ncc\CLI\Management;
if($require_dependency) if($require_dependency)
{ {
$dependencies[] = sprintf(' %s %s', $dependencies[] = sprintf(' %s %s',
Console::formatColor($dependency->Name, ConsoleColors::Green), Console::formatColor($dependency->Name, ConsoleColors::GREEN),
Console::formatColor($dependency->Version, ConsoleColors::LightMagenta) Console::formatColor($dependency->Version, ConsoleColors::LIGHT_MAGENTA)
); );
} }
} }
@ -481,17 +481,17 @@ namespace ncc\CLI\Management;
} }
Console::out(sprintf('Extension: %s', 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) if($package->Header->CompilerExtension->MaximumVersion !== null)
Console::out(sprintf('Maximum Version: %s', 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) if($package->Header->CompilerExtension->MinimumVersion !== null)
Console::out(sprintf('Minimum Version: %s', 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) if(!$user_confirmation)

View file

@ -23,9 +23,9 @@
namespace ncc\CLI\Management; namespace ncc\CLI\Management;
use Exception; use Exception;
use ncc\Abstracts\CompilerExtensionDefaultVersions; use ncc\Enums\CompilerExtensionDefaultVersions;
use ncc\Abstracts\CompilerExtensions; use ncc\Enums\CompilerExtensions;
use ncc\Abstracts\CompilerExtensionSupportedVersions; use ncc\Enums\CompilerExtensionSupportedVersions;
use ncc\Exceptions\AccessDeniedException; use ncc\Exceptions\AccessDeniedException;
use ncc\Exceptions\DirectoryNotFoundException; use ncc\Exceptions\DirectoryNotFoundException;
use ncc\Exceptions\FileNotFoundException; use ncc\Exceptions\FileNotFoundException;
@ -123,7 +123,7 @@ namespace ncc\CLI\Management;
{ {
$compiler_extension = strtolower(($args['extension'] ?? $args['ext'])); $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; $Compiler->Extension = $compiler_extension;
} }

View file

@ -23,7 +23,7 @@
namespace ncc\CLI\Management; namespace ncc\CLI\Management;
use Exception; use Exception;
use ncc\Abstracts\Scopes; use ncc\Enums\Scopes;
use ncc\Exceptions\IOException; use ncc\Exceptions\IOException;
use ncc\Managers\RemoteSourcesManager; use ncc\Managers\RemoteSourcesManager;
use ncc\Objects\CliHelpSection; use ncc\Objects\CliHelpSection;
@ -117,7 +117,7 @@ namespace ncc\CLI\Management;
*/ */
public static function addEntry($args): void 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); Console::outError('Insufficient permissions to add entry.', true, 1);
return; return;
@ -187,7 +187,7 @@ namespace ncc\CLI\Management;
{ {
$ResolvedScope = Resolver::resolveScope(); $ResolvedScope = Resolver::resolveScope();
if($ResolvedScope !== Scopes::System) if($ResolvedScope !== Scopes::SYSTEM)
Console::outError('Insufficient permissions to remove entries'); Console::outError('Insufficient permissions to remove entries');
$name = $args['name'] ?? null; $name = $args['name'] ?? null;

View file

@ -25,12 +25,12 @@ namespace ncc\Classes\ComposerExtension;
use Exception; use Exception;
use FilesystemIterator; use FilesystemIterator;
use JsonException; use JsonException;
use ncc\Abstracts\CompilerExtensions; use ncc\Enums\CompilerExtensions;
use ncc\Abstracts\CompilerExtensionSupportedVersions; use ncc\Enums\CompilerExtensionSupportedVersions;
use ncc\Abstracts\ComponentFileExtensions; use ncc\Enums\ComponentFileExtensions;
use ncc\Abstracts\DependencySourceType; use ncc\Enums\DependencySourceType;
use ncc\Abstracts\LogLevel; use ncc\Enums\LogLevel;
use ncc\Abstracts\Scopes; use ncc\Enums\Scopes;
use ncc\CLI\Main; use ncc\CLI\Main;
use ncc\Exceptions\AccessDeniedException; use ncc\Exceptions\AccessDeniedException;
use ncc\Exceptions\BuildConfigurationNotFoundException; use ncc\Exceptions\BuildConfigurationNotFoundException;
@ -386,7 +386,7 @@ namespace ncc\Classes\ComposerExtension;
$dependency = new ProjectConfiguration\Dependency(); $dependency = new ProjectConfiguration\Dependency();
$dependency->Name = $package_name; $dependency->Name = $package_name;
$dependency->SourceType = DependencySourceType::Local; $dependency->SourceType = DependencySourceType::LOCAL;
$dependency->Version = self::versionMap($item->PackageName, $version_map); $dependency->Version = self::versionMap($item->PackageName, $version_map);
$dependency->Source = $package_name . '.ncc'; $dependency->Source = $package_name . '.ncc';
$project_configuration->Build->addDependency($dependency); $project_configuration->Build->addDependency($dependency);
@ -497,22 +497,22 @@ namespace ncc\Classes\ComposerExtension;
switch (Main::getLogLevel()) switch (Main::getLogLevel())
{ {
default: default:
case LogLevel::Fatal: case LogLevel::FATAL:
case LogLevel::Warning: case LogLevel::WARNING:
case LogLevel::Error: case LogLevel::ERROR:
case LogLevel::Info: case LogLevel::INFO:
$results[] = '-v'; $results[] = '-v';
break; break;
case LogLevel::Verbose: case LogLevel::VERBOSE:
$results[] = '-vv'; $results[] = '-vv';
break; break;
case LogLevel::Debug: case LogLevel::DEBUG:
$results[] = '-vvv'; $results[] = '-vvv';
break; break;
case LogLevel::Silent: case LogLevel::SILENT:
if (!in_array('--quiet', $results, true)) if (!in_array('--quiet', $results, true))
{ {
$results[] = '--quiet'; $results[] = '--quiet';
@ -545,7 +545,7 @@ namespace ncc\Classes\ComposerExtension;
*/ */
private static function require(string $vendor, string $package, ?string $version = null): string 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'); throw new AccessDeniedException('Insufficient permissions to require');
} }
@ -575,7 +575,7 @@ namespace ncc\Classes\ComposerExtension;
$template = str_ireplace('%VERSION%', $version, $template); $template = str_ireplace('%VERSION%', $version, $template);
$filesystem = new Filesystem(); $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'; $composer_json_path = $tmp_dir . DIRECTORY_SEPARATOR . 'composer.json';
if ($filesystem->exists($tmp_dir)) { if ($filesystem->exists($tmp_dir)) {
Console::outVerbose(sprintf('Deleting already existing %s', $tmp_dir)); Console::outVerbose(sprintf('Deleting already existing %s', $tmp_dir));
@ -668,7 +668,7 @@ namespace ncc\Classes\ComposerExtension;
$process->setWorkingDirectory($path); $process->setWorkingDirectory($path);
// Check if scripts are enabled while running as root // 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'); 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 // Include file components that can be compiled
$DirectoryScanner->setIncludes(ComponentFileExtensions::Php); $DirectoryScanner->setIncludes(ComponentFileExtensions::PHP);
foreach ($source_directories as $directory) foreach ($source_directories as $directory)
{ {

View file

@ -22,8 +22,8 @@
namespace ncc\Classes\GithubExtension; namespace ncc\Classes\GithubExtension;
use ncc\Abstracts\HttpRequestType; use ncc\Enums\HttpRequestType;
use ncc\Abstracts\Versions; use ncc\Enums\Versions;
use ncc\Classes\HttpClient; use ncc\Classes\HttpClient;
use ncc\Exceptions\AuthenticationException; use ncc\Exceptions\AuthenticationException;
use ncc\Exceptions\GithubServiceException; use ncc\Exceptions\GithubServiceException;
@ -235,7 +235,7 @@ namespace ncc\Classes\GithubExtension;
throw new VersionNotFoundException('No releases found for the given repository.'); throw new VersionNotFoundException('No releases found for the given repository.');
} }
if ($packageInput->Version === Versions::Latest) if ($packageInput->Version === Versions::LATEST)
{ {
$latest_version = null; $latest_version = null;
foreach ($releases as $release) foreach ($releases as $release)

View file

@ -22,7 +22,7 @@
namespace ncc\Classes\GitlabExtension; namespace ncc\Classes\GitlabExtension;
use ncc\Abstracts\Versions; use ncc\Enums\Versions;
use ncc\Classes\HttpClient; use ncc\Classes\HttpClient;
use ncc\Exceptions\AuthenticationException; use ncc\Exceptions\AuthenticationException;
use ncc\Exceptions\GitlabServiceException; use ncc\Exceptions\GitlabServiceException;
@ -108,7 +108,7 @@
} }
// Query the latest package only // Query the latest package only
if($packageInput->Version === Versions::Latest) if($packageInput->Version === Versions::LATEST)
{ {
$latest_version = null; $latest_version = null;
foreach($releases as $release) foreach($releases as $release)

View file

@ -23,8 +23,8 @@
namespace ncc\Classes; namespace ncc\Classes;
use CurlHandle; use CurlHandle;
use ncc\Abstracts\HttpRequestType; use ncc\Enums\HttpRequestType;
use ncc\Abstracts\LogLevel; use ncc\Enums\LogLevel;
use ncc\CLI\Main; use ncc\CLI\Main;
use ncc\Exceptions\HttpException; use ncc\Exceptions\HttpException;
use ncc\Objects\HttpRequest; use ncc\Objects\HttpRequest;
@ -60,9 +60,9 @@ namespace ncc\Classes;
{ {
switch(Main::getLogLevel()) switch(Main::getLogLevel())
{ {
case LogLevel::Verbose: case LogLevel::VERBOSE:
case LogLevel::Debug: case LogLevel::DEBUG:
case LogLevel::Silent: case LogLevel::SILENT:
Console::outVerbose(sprintf(' <= %s of %s bytes downloaded', $downloaded, $downloadSize)); Console::outVerbose(sprintf(' <= %s of %s bytes downloaded', $downloaded, $downloadSize));
break; break;

View file

@ -22,11 +22,11 @@
namespace ncc\Classes\NccExtension; namespace ncc\Classes\NccExtension;
use ncc\Abstracts\SpecialConstants\BuildConstants; use ncc\Enums\SpecialConstants\BuildConstants;
use ncc\Abstracts\SpecialConstants\DateTimeConstants; use ncc\Enums\SpecialConstants\DateTimeConstants;
use ncc\Abstracts\SpecialConstants\InstallConstants; use ncc\Enums\SpecialConstants\InstallConstants;
use ncc\Abstracts\SpecialConstants\AssemblyConstants; use ncc\Enums\SpecialConstants\AssemblyConstants;
use ncc\Abstracts\SpecialConstants\RuntimeConstants; use ncc\Enums\SpecialConstants\RuntimeConstants;
use ncc\Objects\InstallationPaths; use ncc\Objects\InstallationPaths;
use ncc\Objects\ProjectConfiguration\Assembly; use ncc\Objects\ProjectConfiguration\Assembly;
@ -48,47 +48,47 @@ namespace ncc\Classes\NccExtension;
if($assembly->Name !== null) 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) 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) 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) 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) 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) 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) 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) 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) if($assembly->UUID !== null)
{ {
$input = str_replace(AssemblyConstants::AssemblyUid, $assembly->UUID, $input); $input = str_replace(AssemblyConstants::ASSEMBLY_UID, $assembly->UUID, $input);
} }
return $input; return $input;
@ -109,10 +109,10 @@ namespace ncc\Classes\NccExtension;
return str_replace( return str_replace(
[ [
BuildConstants::CompileTimestamp, BuildConstants::COMPILE_TIMESTAMP,
BuildConstants::NccBuildVersion, BuildConstants::NCC_BUILD_VERSION,
BuildConstants::NccBuildFlags, BuildConstants::NCC_BUILD_FLAGS,
BuildConstants::NccBuildBranch BuildConstants::NCC_BUILD_BRANCH
], ],
[ [
time(), time(),
@ -138,10 +138,10 @@ namespace ncc\Classes\NccExtension;
return str_replace( return str_replace(
[ [
InstallConstants::InstallationPath, InstallConstants::INSTALL_PATH,
InstallConstants::BinPath, InstallConstants::INSTALL_PATH_BIN,
InstallConstants::SourcePath, InstallConstants::INSTALL_PATH_SRC,
InstallConstants::DataPath InstallConstants::INSTALL_PATH_DATA
], ],
[ [
$installationPaths->getInstallationPath(), $installationPaths->getInstallationPath(),
@ -265,7 +265,7 @@ namespace ncc\Classes\NccExtension;
if(function_exists('get_current_user')) 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; return $input;

View file

@ -23,11 +23,11 @@
namespace ncc\Classes\NccExtension; namespace ncc\Classes\NccExtension;
use Exception; use Exception;
use ncc\Abstracts\CompilerExtensions; use ncc\Enums\CompilerExtensions;
use ncc\Abstracts\ConstantReferences; use ncc\Enums\ConstantReferences;
use ncc\Abstracts\LogLevel; use ncc\Enums\LogLevel;
use ncc\Abstracts\Options\BuildConfigurationValues; use ncc\Enums\Options\BuildConfigurationValues;
use ncc\Abstracts\ProjectType; use ncc\Enums\ProjectType;
use ncc\Classes\ComposerExtension\ComposerSourceBuiltin; use ncc\Classes\ComposerExtension\ComposerSourceBuiltin;
use ncc\Classes\PhpExtension\PhpCompiler; use ncc\Classes\PhpExtension\PhpCompiler;
use ncc\CLI\Main; use ncc\CLI\Main;
@ -71,11 +71,11 @@ namespace ncc\Classes\NccExtension;
* @throws ProjectConfigurationNotFoundException * @throws ProjectConfigurationNotFoundException
* @throws UnsupportedCompilerExtensionException * @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(); $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) foreach($configuration->Assembly->toArray() as $prop => $value)
Console::outDebug(sprintf('assembly.%s: %s', $prop, ($value ?? 'n/a'))); Console::outDebug(sprintf('assembly.%s: %s', $prop, ($value ?? 'n/a')));
@ -121,11 +121,11 @@ namespace ncc\Classes\NccExtension;
try try
{ {
if($project_type->ProjectType == ProjectType::Composer) if($project_type->ProjectType == ProjectType::COMPOSER)
{ {
$project_path = ComposerSourceBuiltin::fromLocal($project_type->ProjectPath); $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 = new ProjectManager($project_type->ProjectPath);
$project_manager->getProjectConfiguration()->Assembly->Version = $version; $project_manager->getProjectConfiguration()->Assembly->Version = $version;
@ -204,7 +204,7 @@ namespace ncc\Classes\NccExtension;
* @throws BuildConfigurationNotFoundException * @throws BuildConfigurationNotFoundException
* @throws IOException * @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)); Console::outVerbose(sprintf('Writing package to %s', $path));
@ -373,19 +373,19 @@ namespace ncc\Classes\NccExtension;
if($value == null) if($value == null)
return null; return null;
if(isset($refs[ConstantReferences::Assembly])) if(isset($refs[ConstantReferences::ASSEMBLY]))
$value = ConstantCompiler::compileAssemblyConstants($value, $refs[ConstantReferences::Assembly]); $value = ConstantCompiler::compileAssemblyConstants($value, $refs[ConstantReferences::ASSEMBLY]);
if(isset($refs[ConstantReferences::Build])) if(isset($refs[ConstantReferences::BUILD]))
$value = ConstantCompiler::compileBuildConstants($value); $value = ConstantCompiler::compileBuildConstants($value);
if(isset($refs[ConstantReferences::DateTime])) if(isset($refs[ConstantReferences::DATE_TIME]))
$value = ConstantCompiler::compileDateTimeConstants($value, $refs[ConstantReferences::DateTime]); $value = ConstantCompiler::compileDateTimeConstants($value, $refs[ConstantReferences::DATE_TIME]);
if(isset($refs[ConstantReferences::Install])) if(isset($refs[ConstantReferences::INSTALL]))
$value = ConstantCompiler::compileInstallConstants($value, $refs[ConstantReferences::Install]); $value = ConstantCompiler::compileInstallConstants($value, $refs[ConstantReferences::INSTALL]);
if(isset($refs[ConstantReferences::Runtime])) if(isset($refs[ConstantReferences::RUNTIME]))
$value = ConstantCompiler::compileRuntimeConstants($value); $value = ConstantCompiler::compileRuntimeConstants($value);
return $value; return $value;

View file

@ -22,7 +22,7 @@
namespace ncc\Classes\NccExtension; namespace ncc\Classes\NccExtension;
use ncc\Abstracts\Scopes; use ncc\Enums\Scopes;
use ncc\Exceptions\AccessDeniedException; use ncc\Exceptions\AccessDeniedException;
use ncc\Exceptions\FileNotFoundException; use ncc\Exceptions\FileNotFoundException;
use ncc\Exceptions\IOException; use ncc\Exceptions\IOException;
@ -49,7 +49,7 @@ namespace ncc\Classes\NccExtension;
*/ */
public static function temporaryExecute(string $package, string $version, ExecutionUnit $unit): void 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'); throw new AccessDeniedException('Cannot temporarily execute a unit with insufficient permissions');
$ExecutionPointerManager = new ExecutionPointerManager(); $ExecutionPointerManager = new ExecutionPointerManager();

View file

@ -26,11 +26,11 @@
use Exception; use Exception;
use FilesystemIterator; use FilesystemIterator;
use ncc\Abstracts\ComponentFileExtensions; use ncc\Enums\ComponentFileExtensions;
use ncc\Abstracts\ComponentDataType; use ncc\Enums\ComponentDataType;
use ncc\Abstracts\ConstantReferences; use ncc\Enums\ConstantReferences;
use ncc\Abstracts\DependencySourceType; use ncc\Enums\DependencySourceType;
use ncc\Abstracts\Options\BuildConfigurationValues; use ncc\Enums\Options\BuildConfigurationValues;
use ncc\Classes\NccExtension\PackageCompiler; use ncc\Classes\NccExtension\PackageCompiler;
use ncc\Exceptions\AccessDeniedException; use ncc\Exceptions\AccessDeniedException;
use ncc\Exceptions\BuildConfigurationNotFoundException; use ncc\Exceptions\BuildConfigurationNotFoundException;
@ -90,7 +90,7 @@
* @throws PackagePreparationFailedException * @throws PackagePreparationFailedException
* @throws BuildConfigurationNotFoundException * @throws BuildConfigurationNotFoundException
*/ */
public function prepare(string $build_configuration=BuildConfigurationValues::DefaultConfiguration): void public function prepare(string $build_configuration=BuildConfigurationValues::DEFAULT): void
{ {
try try
{ {
@ -149,7 +149,7 @@
} }
// Include file components that can be compiled // 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) if($selected_build_configuration->ExcludeFiles !== null && count($selected_build_configuration->ExcludeFiles) > 0)
$DirectoryScanner->setExcludes($selected_build_configuration->ExcludeFiles); $DirectoryScanner->setExcludes($selected_build_configuration->ExcludeFiles);
$source_path = $this->path . $this->project->Build->SourcePath; $source_path = $this->path . $this->project->Build->SourcePath;
@ -191,11 +191,11 @@
// Ignore component files // Ignore component files
if($selected_build_configuration->ExcludeFiles !== null && count($selected_build_configuration->ExcludeFiles) > 0) 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 else
{ {
$DirectoryScanner->setExcludes(ComponentFileExtensions::Php); $DirectoryScanner->setExcludes(ComponentFileExtensions::PHP);
} }
Console::outVerbose('Scanning for resources... '); Console::outVerbose('Scanning for resources... ');
@ -249,7 +249,7 @@
Console::outVerbose(sprintf('processing dependency %s', $dependency->Name)); Console::outVerbose(sprintf('processing dependency %s', $dependency->Name));
switch($dependency->SourceType) switch($dependency->SourceType)
{ {
case DependencySourceType::StaticLinking: case DependencySourceType::STATIC:
try try
{ {
@ -277,7 +277,7 @@
break; break;
default: default:
case DependencySourceType::RemoteSource: case DependencySourceType::REMOTE:
break; break;
} }
@ -312,9 +312,9 @@
$this->compileResources(); $this->compileResources();
PackageCompiler::compilePackageConstants($this->package, [ PackageCompiler::compilePackageConstants($this->package, [
ConstantReferences::Assembly => $this->project->Assembly, ConstantReferences::ASSEMBLY => $this->project->Assembly,
ConstantReferences::Build => null, ConstantReferences::BUILD => null,
ConstantReferences::DateTime => time() ConstantReferences::DATE_TIME => time()
]); ]);
return $this->getPackage(); return $this->getPackage();
@ -407,7 +407,7 @@
if($encoded === false) if($encoded === false)
{ {
$component->DataType = ComponentDataType::b64encoded; $component->DataType = ComponentDataType::BASE64_ENCODED;
$component->Data = Base64::encode($content); $component->Data = Base64::encode($content);
} }
else else
@ -418,7 +418,7 @@
} }
catch(Exception $e) catch(Exception $e)
{ {
$component->DataType = ComponentDataType::b64encoded; $component->DataType = ComponentDataType::BASE64_ENCODED;
$component->Data = Base64::encode($content); $component->Data = Base64::encode($content);
unset($e); unset($e);
} }

View file

@ -27,8 +27,8 @@
use ArrayIterator; use ArrayIterator;
use Exception; use Exception;
use ncc\Abstracts\ComponentDataType; use ncc\Enums\ComponentDataType;
use ncc\Abstracts\ComponentFileExtensions; use ncc\Enums\ComponentFileExtensions;
use ncc\Exceptions\AccessDeniedException; use ncc\Exceptions\AccessDeniedException;
use ncc\Exceptions\ComponentChecksumException; use ncc\Exceptions\ComponentChecksumException;
use ncc\Exceptions\ComponentDecodeException; use ncc\Exceptions\ComponentDecodeException;
@ -110,10 +110,10 @@
$prettyPrinter = new Standard(); $prettyPrinter = new Standard();
return $prettyPrinter->prettyPrintFile($stmts); return $prettyPrinter->prettyPrintFile($stmts);
case ComponentDataType::b64encoded: case ComponentDataType::BASE64_ENCODED:
return Base64::decode($component->Data); return Base64::decode($component->Data);
case ComponentDataType::Plain: case ComponentDataType::PLAIN:
return $component->Data; return $component->Data;
default: default:
@ -303,7 +303,7 @@
$configuration->setOutputFile($output); $configuration->setOutputFile($output);
$configuration->setStaticMode(false); $configuration->setStaticMode(false);
// Official PHP file extensions that are missing from the default configuration (whatever) // Official PHP file extensions that are missing from the default configuration (whatever)
$configuration->setInclude(ComponentFileExtensions::Php); $configuration->setInclude(ComponentFileExtensions::PHP);
$configuration->setQuietMode(true); $configuration->setQuietMode(true);
$configuration->setTolerantMode(true); $configuration->setTolerantMode(true);

View file

@ -23,7 +23,7 @@
namespace ncc\Classes\PhpExtension; namespace ncc\Classes\PhpExtension;
use Exception; use Exception;
use ncc\Abstracts\Options\RuntimeImportOptions; use ncc\Enums\Options\RuntimeImportOptions;
use ncc\Classes\NccExtension\ConstantCompiler; use ncc\Classes\NccExtension\ConstantCompiler;
use ncc\Exceptions\ConstantReadonlyException; use ncc\Exceptions\ConstantReadonlyException;
use ncc\Exceptions\ImportException; 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); 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 try
{ {

View file

@ -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 * 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 * A single private access token is used for authentication
*/ */
const AccessToken = 2; public const ACCESS_TOKEN = 2;
} }

View file

@ -20,18 +20,18 @@
* *
*/ */
namespace ncc\Abstracts; namespace ncc\Enums;
class BuiltinRemoteSourceType final class BuiltinRemoteSourceType
{ {
/** /**
* The remote source indicates the package is to be * The remote source indicates the package is to be
* fetched using the composer utility. * fetched using the composer utility.
*/ */
const Composer = 'composer'; public const COMPOSER = 'composer';
const All = [ public const ALL = [
self::Composer self::COMPOSER
]; ];
} }

View file

@ -20,14 +20,14 @@
* *
*/ */
namespace ncc\Abstracts; namespace ncc\Enums;
abstract class CompilerExtensionDefaultVersions final class CompilerExtensionDefaultVersions
{ {
// ---------------------------------------------------------------- // ----------------------------------------------------------------
// [0] = MinimumVersion // [0] = MinimumVersion
// [1] = MaximumVersion // [1] = MaximumVersion
// ---------------------------------------------------------------- // ----------------------------------------------------------------
const PHP = ['8.0', '8.2']; public const PHP = ['8.0', '8.2'];
} }

View file

@ -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'];
} }

View file

@ -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 CompilerExtensions::PHP
]; ];
} }

View file

@ -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 * 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 * Indicates whether the component is represented as plaintext
*/ */
const Plain = 'plain'; public const PLAIN = 'plain';
/** /**
* Indicates whether the component is represented as bytecode * 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 * 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) * Indicates whether the component is represented as as a base64 encoded string (Raw bytes' representation)
*/ */
const b64encoded = 'b64enc'; public const BASE64_ENCODED = 'b64enc';
} }

View file

@ -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. * The file extensions that the PHP compiler extension will accept as components.
* *
* @var array * @var array
*/ */
const Php = ['*.php', '*.php3', '*.php4', '*.php5', '*.phtml']; public const PHP = ['*.php', '*.php3', '*.php4', '*.php5', '*.phtml'];
} }

View file

@ -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` * 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 * 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 * to provide listings of projects to initialize when creating
* a new workspace. * a new workspace.
*/ */
const Project = 'project'; public const PROJECT = 'project';
/** /**
* An empty package that contains requirements and will trigger * 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 * anything to the filesystem. As such, it does not require a
* a dist or source key to be installable * 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 * A package of type `composer-plugin` may provide an installer
* for other packages that have a custom type. * for other packages that have a custom type.
*/ */
const ComposerPlugin = 'composer-plugin'; public const COMPOSER_PLUGIN = 'composer-plugin';
} }

View file

@ -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';
} }

View file

@ -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";
} }

View file

@ -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';
} }

View file

@ -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 * 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 * 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 * 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 * Will still use git to fetch the package from the GitHub instance
*/ */
const Github = 'github'; public const GITHUB = 'github';
const All = [ public const ALL = [
self::Gitlab, self::GITLAB,
self::Github self::GITHUB
]; ];
} }

View file

@ -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 * 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 * Indicates if the dependency is statically linked and the
* reference points to the compiled package of the dependency * 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 * Indicates if the pointer reference points to a remote source
* to fetch the dependency from * to fetch the dependency from
*/ */
const RemoteSource = 'remote'; public const REMOTE = 'remote';
/** /**
* Indicates if the pointer reference points to a relative file with the * Indicates if the pointer reference points to a relative file with the
* filename format "{package_name}=={version}.ncc" to fetch the dependency from * filename format "{package_name}=={version}.ncc" to fetch the dependency from
*/ */
const Local = 'local'; public const LOCAL = 'local';
} }

View file

@ -20,9 +20,9 @@
* *
*/ */
namespace ncc\Abstracts; namespace ncc\Enums;
abstract class EncoderType final class EncoderType
{ {
const ZiProto = '3'; public const ZI_PROTO = '3';
} }

View file

@ -0,0 +1,439 @@
<?php
/*
* Copyright (c) Nosial 2022-2023, all rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction, including without
* limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
* Software, and to permit persons to whom the Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace ncc\Enums;
use ncc\Exceptions\InvalidDependencyConfiguration;
use ncc\Exceptions\SymlinkException;
use ncc\Exceptions\UnsupportedArchiveException;
/**
* @author Zi Xing Narrakas
* @copyright Copyright (C) 2022-2022. Nosial - All Rights Reserved.
*/
final class ExceptionCodes
{
/**
* @see InvalidProjectConfigurationException
*/
public const INVALID_PROJECT_CONFIGURATION = -1700;
/**
* @see FileNotFoundException;
*/
public const FILE_NOT_FOUND = -1701;
/**
* @see DirectoryNotFoundException
*/
public const DIRECTORY_NOT_FOUND = -1702;
/**
* @see InvalidScopeException
*/
public const INVALID_SCOPE = -1703;
/**
* @see AccessDeniedException
*/
public const ACCESS_DENIED = -1704;
/**
* @see MalformedJsonException
*/
public const MALFORMED_JSON = -1705;
/**
* @see RuntimeException
*/
public const RUNTIME = -1706;
/**
* @see InvalidCredentialsEntryException
*/
public const INVALID_CREDENTIALS_ENTRY = -1707;
/**
* @see ComponentVersionNotFoundException
*/
public const COMPONENT_VERSION_NOT_FOUND = -1708;
/**
* @see ConstantReadonlyException
*/
public const CONSTANT_READ_ONLY = -1709;
/**
* @see InvalidPackageNameException
*/
public const INVALID_PACKAGE_NAME = -1710;
/**
* @see InvalidVersionNumberException
*/
public const INVALID_VERSION_NUMBER = -1711;
/**
* @see InvalidProjectNameException
*/
public const INVALID_PROJECT_NAME = -1712;
/**
* @see ProjectAlreadyExistsException
*/
public const PROJECT_ALREADY_EXISTS = -1713;
/**
* @see AutoloadGeneratorException
*/
public const AUTOLOAD_GENERATOR = -1714;
/**
* @see NoUnitsFoundException
*/
public const NO_UNITS_FOUND = -1715;
/**
* @see UnsupportedPackageException
*/
public const UNSUPPORTED_PACKAGE = -1716;
/**
* @see NotImplementedException
*/
public const NOT_IMPLEMENTED = -1717;
/**
* @see InvalidPackageException
*/
public const INVALID_PACKAGE = -1718;
/**
* @see InvalidConstantNameException
*/
public const INVALID_CONSTANT_NAME = -1719;
/**
* @see PackagePreparationFailedException
*/
public const PACKAGE_PREPARATION_FAILED = -1720;
/**
* @see BuildConfigurationNotFoundException
*/
public const BUILD_CONFIGURATION_NOT_FOUND = -1721;
/**
* @see InvalidProjectBuildConfiguration
*/
public const INVALID_PROJECT_BUILD_CONFIGURATION = -1722;
/**
* @see UnsupportedCompilerExtensionException
*/
public const UNSUPPORTED_COMPILER_EXTENSION = -1723;
/**
* @see InvalidPropertyValueException
*/
public const INVALID_PROPERTY_VALUE = -1724;
/**
* @see InvalidVersionConfigurationException
*/
public const INVALID_VERSION_CONFIGURATION = -1725;
/**
* @see UnsupportedExtensionVersionException
*/
public const UNSUPPORTED_EXTENSION_VERSION = -1726;
/**
* @see BuildException
*/
public const BUILD_EXCEPTION = -1727;
/**
* @see PackageParsingException
*/
public const PACKAGE_PARSING_EXCEPTION = -1728;
/**
* @see PackageLockException
*/
public const PACKAGE_LOCK_EXCEPTION = -1729;
/**
* @see InstallationException
*/
public const INSTALLATION_EXCEPTION = -1730;
/**
* @see UnsupportedComponentTypeException
*/
public const UNSUPPORTED_COMPONENT_TYPE = -1731;
/**
* @see ComponentDecodeException
*/
public const COMPONENT_DECODE_EXCEPTION = -1732;
/**
* @see ComponentChecksumException
*/
public const COMPONENT_CHECKSUM_EXCEPTION = -1733;
/**
* @see ResourceChecksumException
*/
public const RESOURCE_CHECKSUM_EXCEPTION = -1734;
/**
* @see IOException
*/
public const IO_EXCEPTION = -1735;
/**
* @see VersionNotFoundException
*/
public const VERSION_NOT_FOUND = -1737;
/**
* @see UndefinedExecutionPolicyException
*/
public const UNDEFINED_EXECUTION_POLICY = -1738;
/**
* @see InvalidExecutionPolicyName
*/
public const INVALID_EXECUTION_POLICY_NAME = -1739;
/**
* @see ProjectConfigurationNotFoundException
*/
public const PROJECT_CONFIGURATION_NOT_FOUND = -1740;
/**
* @see RunnerExecutionException
*/
public const RUNNER_EXECUTION_EXCEPTION = -1741;
/**
* @see NoAvailableUnitsException
*/
public const NO_AVAILABLE_UNITS = -1742;
/**
* @see PackageAlreadyInstalledException
*/
public const PACKAGE_ALREADY_INSTALLED = -1744;
/**
* @see PackageNotFoundException
*/
public const PACKAGE_NOT_FOUND = -1745;
/**
* @see ComposerDisabledException
*/
public const COMPOSER_DISABLED_EXCEPTION = -1746;
/**
* @see InternalComposerNotAvailableException
*/
public const INTERNAL_COMPOSER_NOT_AVAILABLE = -1747;
/**
* @see ComposerNotAvailableException
*/
public const COMPOSER_NOT_AVAILABLE = -1748;
/**
* @see ComposerException
*/
public const COMPOSER_EXCEPTION = -1749;
/**
* @see UserAbortedOperationException
*/
public const USER_ABORTED_OPERATION = -1750;
/**
* @see MissingDependencyException
*/
public const MISSING_DEPENDENCY = -1751;
/**
* @see HttpException
*/
public const HTTP_EXCEPTION = -1752;
/**
* @see UnsupportedRemoteSourceTypeException
*/
public const UNSUPPORTED_REMOTE_SOURCE_TYPE = -1753;
/**
* @see GitCloneException
*/
public const GIT_CLONE_EXCEPTION = -1754;
/**
* @see GitCheckoutException
*/
public const GIT_CHECKOUT_EXCEPTION = -1755;
/**
* @see GitlabServiceException
*/
public const GITLAB_SERVICE_EXCEPTION = -1756;
/**
* @see ImportException
*/
public const IMPORT_EXCEPTION = -1757;
/**
* @see GitTagsException
*/
public const GIT_TAGS_EXCEPTION = -1758;
/**
* @see GithubServiceException
*/
public const GITHUB_SERVICE_EXCEPTION = -1759;
/**
* @see AuthenticationException
*/
public const AUTHENTICATION_EXCEPTION = -1760;
/**
* @see NotSupportedException
*/
public const NOT_SUPPORTED_EXCEPTION = -1761;
/**
* @see UnsupportedProjectTypeException
*/
public const UNSUPPORTED_PROJECT_TYPE = -1762;
/**
* @see UnsupportedArchiveException
*/
public const UNSUPPORTED_ARCHIVE = -1763;
/**
* @see ArchiveException
*/
public const ARCHIVE_EXCEPTION = -1764;
/**
* @see PackageFetchException
*/
public const PACKAGE_FETCH_EXCEPTION = -1765;
/**
* @see InvalidBuildConfigurationException
*/
public const INVALID_BUILD_CONFIGURATION = -1766;
/**
* @see InvalidDependencyConfiguration
*/
public const INVALID_DEPENDENCY_CONFIGURATION = -1767;
/**
* @see SymlinkException
*/
public const SYMLINK_EXCEPTION = -1768;
/**
* All the exception codes from NCC
*/
public const All = [
self::INVALID_PROJECT_CONFIGURATION,
self::FILE_NOT_FOUND,
self::DIRECTORY_NOT_FOUND,
self::INVALID_SCOPE,
self::ACCESS_DENIED,
self::MALFORMED_JSON,
self::RUNTIME,
self::INVALID_CREDENTIALS_ENTRY,
self::COMPONENT_VERSION_NOT_FOUND,
self::CONSTANT_READ_ONLY,
self::INVALID_PACKAGE_NAME,
self::INVALID_VERSION_NUMBER,
self::INVALID_PROJECT_NAME,
self::PROJECT_ALREADY_EXISTS,
self::AUTOLOAD_GENERATOR,
self::NO_UNITS_FOUND,
self::UNSUPPORTED_PACKAGE,
self::NOT_IMPLEMENTED,
self::INVALID_PACKAGE,
self::INVALID_CONSTANT_NAME,
self::PACKAGE_PREPARATION_FAILED,
self::BUILD_CONFIGURATION_NOT_FOUND,
self::INVALID_PROJECT_BUILD_CONFIGURATION,
self::UNSUPPORTED_COMPILER_EXTENSION,
self::INVALID_PROPERTY_VALUE,
self::INVALID_VERSION_CONFIGURATION,
self::UNSUPPORTED_EXTENSION_VERSION,
self::BUILD_EXCEPTION,
self::PACKAGE_PARSING_EXCEPTION,
self::PACKAGE_LOCK_EXCEPTION,
self::INSTALLATION_EXCEPTION,
self::UNSUPPORTED_COMPONENT_TYPE,
self::COMPONENT_DECODE_EXCEPTION,
self::RESOURCE_CHECKSUM_EXCEPTION,
self::IO_EXCEPTION,
self::VERSION_NOT_FOUND,
self::UNDEFINED_EXECUTION_POLICY,
self::INVALID_EXECUTION_POLICY_NAME,
self::PROJECT_CONFIGURATION_NOT_FOUND,
self::RUNNER_EXECUTION_EXCEPTION,
self::NO_AVAILABLE_UNITS,
self::PACKAGE_ALREADY_INSTALLED,
self::PACKAGE_NOT_FOUND,
self::COMPOSER_DISABLED_EXCEPTION,
self::INTERNAL_COMPOSER_NOT_AVAILABLE,
self::COMPOSER_NOT_AVAILABLE,
self::COMPOSER_EXCEPTION,
self::USER_ABORTED_OPERATION,
self::MISSING_DEPENDENCY,
self::HTTP_EXCEPTION,
self::UNSUPPORTED_REMOTE_SOURCE_TYPE,
self::GIT_CLONE_EXCEPTION,
self::GIT_CHECKOUT_EXCEPTION,
self::GITLAB_SERVICE_EXCEPTION,
self::GIT_TAGS_EXCEPTION,
self::AUTHENTICATION_EXCEPTION,
self::NOT_SUPPORTED_EXCEPTION,
self::UNSUPPORTED_PROJECT_TYPE,
self::UNSUPPORTED_ARCHIVE,
self::ARCHIVE_EXCEPTION,
self::PACKAGE_FETCH_EXCEPTION,
self::INVALID_BUILD_CONFIGURATION,
self::INVALID_DEPENDENCY_CONFIGURATION,
self::SYMLINK_EXCEPTION,
];
}

View file

@ -20,12 +20,12 @@
* *
*/ */
namespace ncc\Abstracts; namespace ncc\Enums;
abstract class HttpRequestType final class HttpRequestType
{ {
const GET = 'GET'; public const GET = 'GET';
const POST = 'POST'; public const POST = 'POST';
const PUT = 'PUT'; public const PUT = 'PUT';
const DELETE = 'DELETE'; public const DELETE = 'DELETE';
} }

View file

@ -20,59 +20,59 @@
* *
*/ */
namespace ncc\Abstracts; namespace ncc\Enums;
abstract class HttpStatusCodes final class HttpStatusCodes
{ {
const OK = 200; public const OK = 200;
const CREATED = 201; public const CREATED = 201;
const ACCEPTED = 202; public const ACCEPTED = 202;
const NO_CONTENT = 204; public const NO_CONTENT = 204;
const MOVED_PERMANENTLY = 301; public const MOVED_PERMANENTLY = 301;
const FOUND = 302; public const FOUND = 302;
const SEE_OTHER = 303; public const SEE_OTHER = 303;
const NOT_MODIFIED = 304; public const NOT_MODIFIED = 304;
const TEMPORARY_REDIRECT = 307; public const TEMPORARY_REDIRECT = 307;
const PERMANENT_REDIRECT = 308; public const PERMANENT_REDIRECT = 308;
const BAD_REQUEST = 400; public const BAD_REQUEST = 400;
const UNAUTHORIZED = 401; public const UNAUTHORIZED = 401;
const FORBIDDEN = 403; public const FORBIDDEN = 403;
const NOT_FOUND = 404; public const NOT_FOUND = 404;
const METHOD_NOT_ALLOWED = 405; public const METHOD_NOT_ALLOWED = 405;
const NOT_ACCEPTABLE = 406; public const NOT_ACCEPTABLE = 406;
const REQUEST_TIMEOUT = 408; public const REQUEST_TIMEOUT = 408;
const CONFLICT = 409; public const CONFLICT = 409;
const GONE = 410; public const GONE = 410;
const LENGTH_REQUIRED = 411; public const LENGTH_REQUIRED = 411;
const PRECONDITION_FAILED = 412; public const PRECONDITION_FAILED = 412;
const PAYLOAD_TOO_LARGE = 413; public const PAYLOAD_TOO_LARGE = 413;
const URI_TOO_LONG = 414; public const URI_TOO_LONG = 414;
const UNSUPPORTED_MEDIA_TYPE = 415; public const UNSUPPORTED_MEDIA_TYPE = 415;
const RANGE_NOT_SATISFIABLE = 416; public const RANGE_NOT_SATISFIABLE = 416;
const EXPECTATION_FAILED = 417; public const EXPECTATION_FAILED = 417;
const IM_A_TEAPOT = 418; public const IM_A_TEAPOT = 418;
const MISDIRECTED_REQUEST = 421; public const MISDIRECTED_REQUEST = 421;
const UNPROCESSABLE_ENTITY = 422; public const UNPROCESSABLE_ENTITY = 422;
const LOCKED = 423; public const LOCKED = 423;
const FAILED_DEPENDENCY = 424; public const FAILED_DEPENDENCY = 424;
const UPGRADE_REQUIRED = 426; public const UPGRADE_REQUIRED = 426;
const PRECONDITION_REQUIRED = 428; public const PRECONDITION_REQUIRED = 428;
const TOO_MANY_REQUESTS = 429; public const TOO_MANY_REQUESTS = 429;
const REQUEST_HEADER_FIELDS_TOO_LARGE = 431; public const REQUEST_HEADER_FIELDS_TOO_LARGE = 431;
const UNAVAILABLE_FOR_LEGAL_REASONS = 451; public const UNAVAILABLE_FOR_LEGAL_REASONS = 451;
const INTERNAL_SERVER_ERROR = 500; public const INTERNAL_SERVER_ERROR = 500;
const NOT_IMPLEMENTED = 501; public const NOT_IMPLEMENTED = 501;
const BAD_GATEWAY = 502; public const BAD_GATEWAY = 502;
const SERVICE_UNAVAILABLE = 503; public const SERVICE_UNAVAILABLE = 503;
const GATEWAY_TIMEOUT = 504; public const GATEWAY_TIMEOUT = 504;
const HTTP_VERSION_NOT_SUPPORTED = 505; public const HTTP_VERSION_NOT_SUPPORTED = 505;
const VARIANT_ALSO_NEGOTIATES = 506; public const VARIANT_ALSO_NEGOTIATES = 506;
const INSUFFICIENT_STORAGE = 507; public const INSUFFICIENT_STORAGE = 507;
const LOOP_DETECTED = 508; public const LOOP_DETECTED = 508;
const NOT_EXTENDED = 510; public const NOT_EXTENDED = 510;
const NETWORK_AUTHENTICATION_REQUIRED = 511; public const NETWORK_AUTHENTICATION_REQUIRED = 511;
const All = [ public const ALL = [
self::OK, self::OK,
self::CREATED, self::CREATED,
self::ACCEPTED, self::ACCEPTED,

View file

@ -20,31 +20,31 @@
* *
*/ */
namespace ncc\Abstracts; namespace ncc\Enums;
abstract class LogLevel final class LogLevel
{ {
const Silent = 'silent'; public const SILENT = 'silent';
const Verbose = 'verbose'; public const VERBOSE = 'verbose';
const Debug = 'debug'; public const DEBUG = 'debug';
const Info = 'info'; public const INFO = 'info';
const Warning = 'warn'; public const WARNING = 'warn';
const Error = 'error'; public const ERROR = 'error';
const Fatal = 'fatal'; public const FATAL = 'fatal';
const All = [ public const ALL = [
self::Silent, self::SILENT,
self::Verbose, self::VERBOSE,
self::Debug, self::DEBUG,
self::Info, self::INFO,
self::Warning, self::WARNING,
self::Error, self::ERROR,
self::Fatal, self::FATAL,
]; ];
} }

View file

@ -20,13 +20,13 @@
* *
*/ */
namespace ncc\Abstracts; namespace ncc\Enums;
abstract class NccBuildFlags final class NccBuildFlags
{ {
/** /**
* Indicates if the build is currently unstable and some features may not work correctly * Indicates if the build is currently unstable and some features may not work correctly
* and can cause errors * and can cause errors
*/ */
const Unstable = 'unstable'; public const UNSTABLE = 'unstable';
} }

View file

@ -20,11 +20,11 @@
* *
*/ */
namespace ncc\Abstracts\Options; namespace ncc\Enums\Options;
abstract class BuildConfigurationValues final class BuildConfigurationValues
{ {
const DefaultConfiguration = 'default'; public const DEFAULT = 'default';
const AllConfigurations = 'all'; public const ALL = 'all';
} }

View file

@ -20,9 +20,9 @@
* *
*/ */
namespace ncc\Abstracts\Options; namespace ncc\Enums\Options;
abstract class InitializeProjectOptions final class InitializeProjectOptions
{ {
const CREATE_SOURCE_DIRECTORY = 1; public const CREATE_SOURCE_DIRECTORY = 1;
} }

View file

@ -20,9 +20,9 @@
* *
*/ */
namespace ncc\Abstracts\Options; namespace ncc\Enums\Options;
abstract class InstallPackageOptions final class InstallPackageOptions
{ {
/** /**
* Skips the installation of dependencies of the package * Skips the installation of dependencies of the package
@ -30,11 +30,11 @@ namespace ncc\Abstracts\Options;
* @warning This will cause the package to fail to import of * @warning This will cause the package to fail to import of
* the dependencies are not met * the dependencies are not met
*/ */
const SkipDependencies = 'skip_dependencies'; public const SKIP_DEPENDENCIES = 'skip_dependencies';
/** /**
* Reinstall all packages if they are already installed * Reinstall all packages if they are already installed,
* Including dependencies if they are being processed. * Including dependencies if they are being processed.
*/ */
const Reinstall = 'reinstall'; public const REINSTALL = 'reinstall';
} }

View file

@ -20,19 +20,19 @@
* *
*/ */
namespace ncc\Abstracts\Options; namespace ncc\Enums\Options;
abstract class RuntimeImportOptions final class RuntimeImportOptions
{ {
/** /**
* Indicates if the import should require PHP's autoload.php file * Indicates if the import should require PHP's autoload.php file
* for the package (Only applies to PHP packages) * for the package (Only applies to PHP packages)
*/ */
const ImportAutoloader = 'import_autoloader'; public const IMPORT_AUTOLOADER = 'import_autoloader';
/** /**
* Indicates if the import should require all static files * Indicates if the import should require all static files
* for the package (Only applies to PHP packages) * for the package (Only applies to PHP packages)
*/ */
const ImportStaticFiles = 'import_static_files'; public const IMPORT_STATIC_FILES = 'import_static_files';
} }

View file

@ -20,9 +20,9 @@
* *
*/ */
namespace ncc\Abstracts; namespace ncc\Enums;
abstract class PackageStandardVersions final class PackageStandardVersions
{ {
const VERSION_1 = '1.0'; public const VERSION_1 = '1.0';
} }

View file

@ -20,13 +20,13 @@
* *
*/ */
namespace ncc\Abstracts; namespace ncc\Enums;
abstract class PackageStructureVersions final class PackageStructureVersions
{ {
const _1_0 = '1.0'; public const _1_0 = '1.0';
const ALL = [ public const ALL = [
self::_1_0 self::_1_0
]; ];
} }

View file

@ -20,13 +20,13 @@
* *
*/ */
namespace ncc\Abstracts; namespace ncc\Enums;
abstract class ProjectType final class ProjectType
{ {
const Composer = 'composer'; public const COMPOSER = 'composer';
const Ncc = 'ncc'; public const NCC = 'ncc';
const Unknown = 'unknown'; public const UNKNOWN = 'unknown';
} }

View file

@ -20,35 +20,35 @@
* *
*/ */
namespace ncc\Abstracts; namespace ncc\Enums;
/** /**
* @author Zi Xing Narrakas * @author Zi Xing Narrakas
* @copyright Copyright (C) 2022-2022. Nosial - All Rights Reserved. * @copyright Copyright (C) 2022-2022. Nosial - All Rights Reserved.
*/ */
abstract class RegexPatterns final class RegexPatterns
{ {
const UUID = '{^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$}Di'; public const UUID = '{^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$}Di';
const PackageNameFormat = '/^[a-z][a-z0-9_]*(\.[a-z0-9_]+)+[0-9a-z_]$/'; public const PACKAGE_NAME_FORMAT = '/^[a-z][a-z0-9_]*(\.[a-z0-9_]+)+[0-9a-z_]$/';
const ComposerVersionFormat = '/^([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/'; public const COMPOSER_VERSION_FORMAT = '/^([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/';
const PythonVersionFormat = '/^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/'; public const PYTHON_VERSION_FORMAT = '/^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/';
const SemanticVersioning2 = '/^(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?: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<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/m'; public const SEMANTIC_VERSIONING_2 = '/^(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?: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<buildmetadata>[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 <purplex> * @author <purplex>
*/ */
const RemotePackage = '/^(?<vendor>[^\/\n]+)\/(?<package>[^:=\n@]+)(?:=(?<version>[^:@\n]+))?(?::(?<branch>[^@\n]+))?@(?<source>.*)$/m'; public const REMOTE_PACKAGE = '/^(?<vendor>[^\/\n]+)\/(?<package>[^:=\n@]+)(?:=(?<version>[^:@\n]+))?(?::(?<branch>[^@\n]+))?@(?<source>.*)$/m';
} }

View file

@ -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 * A builtin source type is not defined by the user but handled by
* an extension built into NCC * 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 * 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 * and handled by an extension designed by passing on the information of
* the source to the extension * the source to the extension
*/ */
const Defined = 'defined'; public const DEFINED = 'defined';
/** /**
* Unsupported or invalid source type * Unsupported or invalid source type
*/ */
const Unknown = 'unknown'; public const UNKNOWN = 'unknown';
const All = [ public const All = [
self::Builtin, self::BUILTIN,
self::Defined, self::DEFINED,
self::Unknown self::UNKNOWN
]; ];
} }

View file

@ -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';
public const ALL = [
const All = [ self::PHP,
self::php, self::BASH,
self::bash, self::PYTHON,
self::python, self::PYTHON_3,
self::python3, self::PYTHON_2,
self::python2, self::PERL,
self::perl, self::LUA
self::lua
]; ];
} }

View file

@ -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';
} }

View file

@ -20,52 +20,52 @@
* *
*/ */
namespace ncc\Abstracts\SpecialConstants; namespace ncc\Enums\SpecialConstants;
abstract class AssemblyConstants final class AssemblyConstants
{ {
/** /**
* Assembly's Name Property * Assembly's Name Property
*/ */
const AssemblyName = '%ASSEMBLY.NAME%'; public const ASSEMBLY_NAME = '%ASSEMBLY.NAME%';
/** /**
* Assembly's Package Property * Assembly's Package Property
*/ */
const AssemblyPackage = '%ASSEMBLY.PACKAGE%'; public const ASSEMBLY_PACKAGE = '%ASSEMBLY.PACKAGE%';
/** /**
* Assembly's Description Property * Assembly's Description Property
*/ */
const AssemblyDescription = '%ASSEMBLY.DESCRIPTION%'; public const ASSEMBLY_DESCRIPTION = '%ASSEMBLY.DESCRIPTION%';
/** /**
* Assembly's Company Property * Assembly's Company Property
*/ */
const AssemblyCompany = '%ASSEMBLY.COMPANY%'; public const ASSEMBLY_COMPANY = '%ASSEMBLY.COMPANY%';
/** /**
* Assembly's Product Property * Assembly's Product Property
*/ */
const AssemblyProduct = '%ASSEMBLY.PRODUCT%'; public const ASSEMBLY_PRODUCT = '%ASSEMBLY.PRODUCT%';
/** /**
* Assembly's Copyright Property * Assembly's Copyright Property
*/ */
const AssemblyCopyright = '%ASSEMBLY.COPYRIGHT%'; public const ASSEMBLY_COPYRIGHT = '%ASSEMBLY.COPYRIGHT%';
/** /**
* Assembly's Trademark Property * Assembly's Trademark Property
*/ */
const AssemblyTrademark = '%ASSEMBLY.TRADEMARK%'; public const ASSEMBLY_TRADEMARK = '%ASSEMBLY.TRADEMARK%';
/** /**
* Assembly's Version Property * Assembly's Version Property
*/ */
const AssemblyVersion = '%ASSEMBLY.VERSION%'; public const ASSEMBLY_VERSION = '%ASSEMBLY.VERSION%';
/** /**
* Assembly's UUID property * Assembly's UUID property
*/ */
const AssemblyUid = '%ASSEMBLY.UID%'; public const ASSEMBLY_UID = '%ASSEMBLY.UID%';
} }

View file

@ -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 * 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 * 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 * NCC Build Flags exploded into spaces
*/ */
const NccBuildFlags = '%NCC_BUILD_FLAGS%'; public const NCC_BUILD_FLAGS = '%NCC_BUILD_FLAGS%';
/** /**
* NCC Build Branch * NCC Build Branch
*/ */
const NccBuildBranch = '%NCC_BUILD_BRANCH%'; public const NCC_BUILD_BRANCH = '%NCC_BUILD_BRANCH%';
} }

View file

@ -20,51 +20,51 @@
* *
*/ */
namespace ncc\Abstracts\SpecialConstants; namespace ncc\Enums\SpecialConstants;
abstract class DateTimeConstants final class DateTimeConstants
{ {
// Day Format // Day Format
/** /**
* Day of the month, 2 digits with leading zeros * 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 * 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 * 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 * 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 * 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 * 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 * 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) * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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, * ISO 8601 week-numbering year. This has the same value as Y,
* except that if the ISO week number (W) belongs to the previous * except that if the ISO week number (W) belongs to the previous
* or next year, that year is used instead. * 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. * 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 * A two digit representation of a year
*/ */
const y = '%y%'; // 91, 12, 14, ... public const y = '%y%'; // 91, 12, 14, ...
// Time Format // Time Format
/** /**
* Lowercase Ante meridiem and Post meridiem * 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 * Uppercase Ante meridiem and Post meridiem
*/ */
const A = '%A%'; // AM or PM public const A = '%A%'; // AM or PM
/** /**
* Swatch Internet time * 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 * 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 * 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 * 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 * 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 * Minutes with leading zeros
*/ */
const i = '%i%'; // 01 through 59 public const i = '%i%'; // 01 through 59
/** /**
* Seconds with leading zeros * Seconds with leading zeros
*/ */
const s = '%s%'; // 00 through 59 public const s = '%s%'; // 00 through 59
// DateTime format // DateTime format
const c = '%c%'; // 2004-02-12T15:19:21 public const c = '%c%'; // 2004-02-12T15:19:21
const r = '%r%'; // Thu, 21 Dec 2000 16:01:07 public 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 u = '%u%'; // Unix Timestamp (seconds since Jan 1 1970 00:00:00)
} }

View file

@ -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%';
} }

View file

@ -20,14 +20,13 @@
* *
*/ */
namespace ncc\Abstracts\SpecialConstants; namespace ncc\Enums\SpecialConstants;
abstract class RuntimeConstants final class RuntimeConstants
{ {
const CWD = '%CWD%'; public const CWD = '%CWD%';
public const PID = '%PID%';
const PID = '%PID%'; public const UID = '%UID%';
const UID = '%UID%'; public const GID = '%GID%';
const GID = '%GID%'; public const USER = '%USER%';
const User = '%USER%';
} }

View file

@ -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 * 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 * 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 * 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) * Generic version of the package structure file format (latest)
*/ */
const Latest = 'latest'; public const LATEST = 'latest';
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class AccessDeniedException extends Exception class AccessDeniedException extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::AccessDeniedException, $previous); parent::__construct($message, ExceptionCodes::ACCESS_DENIED, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class ArchiveException extends Exception class ArchiveException extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::ArchiveException, $previous); parent::__construct($message, ExceptionCodes::ARCHIVE_EXCEPTION, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class AuthenticationException extends Exception class AuthenticationException extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::AuthenticationException, $previous); parent::__construct($message, ExceptionCodes::AUTHENTICATION_EXCEPTION, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class AutoloadGeneratorException extends Exception class AutoloadGeneratorException extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::AutoloadGeneratorException, $previous); parent::__construct($message, ExceptionCodes::AUTOLOAD_GENERATOR, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class BuildConfigurationNotFoundException extends Exception class BuildConfigurationNotFoundException extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::BuildConfigurationNotFoundException, $previous); parent::__construct($message, ExceptionCodes::BUILD_CONFIGURATION_NOT_FOUND, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class BuildException extends Exception class BuildException extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::BuildException, $previous); parent::__construct($message, ExceptionCodes::BUILD_EXCEPTION, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class ComponentChecksumException extends Exception class ComponentChecksumException extends Exception
@ -35,6 +35,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::ComponentChecksumException, $previous); parent::__construct($message, ExceptionCodes::COMPONENT_CHECKSUM_EXCEPTION, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class ComponentDecodeException extends Exception class ComponentDecodeException extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::ComponentDecodeException, $previous); parent::__construct($message, ExceptionCodes::COMPONENT_DECODE_EXCEPTION, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class ComponentVersionNotFoundException extends Exception class ComponentVersionNotFoundException extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::ComponentVersionNotFoundException, $previous); parent::__construct($message, ExceptionCodes::COMPONENT_VERSION_NOT_FOUND, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class ComposerDisabledException extends Exception class ComposerDisabledException extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::ComposerDisabledException, $previous); parent::__construct($message, ExceptionCodes::COMPOSER_DISABLED_EXCEPTION, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class ComposerException extends Exception class ComposerException extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::ComposerException, $previous); parent::__construct($message, ExceptionCodes::COMPOSER_EXCEPTION, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
class ComposerNotAvailableException extends Exception class ComposerNotAvailableException extends Exception
{ {
@ -33,6 +33,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", $previous = null) public function __construct(string $message = "", $previous = null)
{ {
parent::__construct($message, ExceptionCodes::ComposerNotAvailableException, $previous); parent::__construct($message, ExceptionCodes::COMPOSER_NOT_AVAILABLE, $previous);
} }
} }

View file

@ -24,7 +24,7 @@ namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class ConstantReadonlyException extends Exception class ConstantReadonlyException extends Exception

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class DirectoryNotFoundException extends Exception class DirectoryNotFoundException extends Exception
@ -36,6 +36,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $path = "", ?Throwable $previous = null) 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);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
/** /**
@ -38,6 +38,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $path = "", ?Throwable $previous = null) 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);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class GitCheckoutException extends Exception class GitCheckoutException extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::GitCheckoutException, $previous); parent::__construct($message, ExceptionCodes::GIT_CHECKOUT_EXCEPTION, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class GitCloneException extends Exception class GitCloneException extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::GitCloneException, $previous); parent::__construct($message, ExceptionCodes::GIT_CLONE_EXCEPTION, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class GitTagsException extends Exception class GitTagsException extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::GitTagsException, $previous); parent::__construct($message, ExceptionCodes::GIT_TAGS_EXCEPTION, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class GithubServiceException extends Exception class GithubServiceException extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::GithubServiceException, $previous); parent::__construct($message, ExceptionCodes::GITHUB_SERVICE_EXCEPTION, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class GitlabServiceException extends Exception class GitlabServiceException extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::GitlabServiceException, $previous); parent::__construct($message, ExceptionCodes::GITLAB_SERVICE_EXCEPTION, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class HttpException extends Exception class HttpException extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::HttpException, $previous); parent::__construct($message, ExceptionCodes::HTTP_EXCEPTION, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class IOException extends Exception class IOException extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::IOException, $previous); parent::__construct($message, ExceptionCodes::IO_EXCEPTION, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class ImportException extends Exception class ImportException extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::ImportException, $previous); parent::__construct($message, ExceptionCodes::IMPORT_EXCEPTION, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class InstallationException extends Exception class InstallationException extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::InstallationException, $previous); parent::__construct($message, ExceptionCodes::INSTALLATION_EXCEPTION, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class InternalComposerNotAvailableException extends Exception class InternalComposerNotAvailableException extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::InternalComposerNotAvailable, $previous); parent::__construct($message, ExceptionCodes::INTERNAL_COMPOSER_NOT_AVAILABLE, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class InvalidBuildConfigurationException extends Exception class InvalidBuildConfigurationException extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::InvalidBuildConfigurationException, $previous); parent::__construct($message, ExceptionCodes::INVALID_BUILD_CONFIGURATION, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class InvalidConstantNameException extends Exception class InvalidConstantNameException extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::InvalidConstantNameException, $previous); parent::__construct($message, ExceptionCodes::INVALID_CONSTANT_NAME, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class InvalidCredentialsEntryException extends Exception class InvalidCredentialsEntryException extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::InvalidCredentialsEntryException, $previous); parent::__construct($message, ExceptionCodes::INVALID_CREDENTIALS_ENTRY, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class InvalidDependencyConfiguration extends Exception class InvalidDependencyConfiguration extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::InvalidDependencyConfiguration, $previous); parent::__construct($message, ExceptionCodes::INVALID_DEPENDENCY_CONFIGURATION, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class InvalidExecutionPolicyName extends Exception class InvalidExecutionPolicyName extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::InvalidExecutionPolicyName, $previous); parent::__construct($message, ExceptionCodes::INVALID_EXECUTION_POLICY_NAME, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class InvalidPackageException extends Exception class InvalidPackageException extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::InvalidPackageException, $previous); parent::__construct($message, ExceptionCodes::INVALID_PACKAGE, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class InvalidPackageNameException extends Exception class InvalidPackageNameException extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::InvalidPackageNameException, $previous); parent::__construct($message, ExceptionCodes::INVALID_PACKAGE_NAME, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class InvalidProjectBuildConfiguration extends Exception class InvalidProjectBuildConfiguration extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::InvalidProjectBuildConfiguration, $previous); parent::__construct($message, ExceptionCodes::INVALID_PROJECT_BUILD_CONFIGURATION, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
/** /**
@ -44,7 +44,7 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?string $property=null, ?Throwable $previous = null) 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; $this->property = $property;
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class InvalidProjectNameException extends Exception class InvalidProjectNameException extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::InvalidProjectNameException, $previous); parent::__construct($message, ExceptionCodes::INVALID_PROJECT_NAME, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class InvalidPropertyValueException extends Exception class InvalidPropertyValueException extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::InvalidPropertyValueException, $previous); parent::__construct($message, ExceptionCodes::INVALID_PROPERTY_VALUE, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class InvalidScopeException extends Exception class InvalidScopeException extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $scope = "", ?Throwable $previous = null) 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);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class InvalidVersionConfigurationException extends Exception class InvalidVersionConfigurationException extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::InvalidVersionConfigurationException, $previous); parent::__construct($message, ExceptionCodes::INVALID_VERSION_CONFIGURATION, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class InvalidVersionNumberException extends Exception class InvalidVersionNumberException extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::InvalidVersionNumberException, $previous); parent::__construct($message, ExceptionCodes::INVALID_VERSION_NUMBER, $previous);
} }
} }

View file

@ -24,7 +24,7 @@ namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class MalformedJsonException extends Exception class MalformedJsonException extends Exception
@ -35,6 +35,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::MalformedJsonException, $previous); parent::__construct($message, ExceptionCodes::MALFORMED_JSON, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class MissingDependencyException extends Exception class MissingDependencyException extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::MissingDependencyException, $previous); parent::__construct($message, ExceptionCodes::MISSING_DEPENDENCY, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class NoAvailableUnitsException extends Exception class NoAvailableUnitsException extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::NoAvailableUnitsException, $previous); parent::__construct($message, ExceptionCodes::NO_AVAILABLE_UNITS, $previous);
} }
} }

View file

@ -23,7 +23,7 @@
namespace ncc\Exceptions; namespace ncc\Exceptions;
use Exception; use Exception;
use ncc\Abstracts\ExceptionCodes; use ncc\Enums\ExceptionCodes;
use Throwable; use Throwable;
class NoUnitsFoundException extends Exception class NoUnitsFoundException extends Exception
@ -34,6 +34,6 @@ namespace ncc\Exceptions;
*/ */
public function __construct(string $message = "", ?Throwable $previous = null) public function __construct(string $message = "", ?Throwable $previous = null)
{ {
parent::__construct($message, ExceptionCodes::NoUnitsFoundException, $previous); parent::__construct($message, ExceptionCodes::NO_UNITS_FOUND, $previous);
} }
} }

Some files were not shown because too many files have changed in this diff Show more