- Corrected code-smell and code style issues in \ncc\Objects > PackageLock
- Removed unused exception `InvalidProjectConfigurationException` in `\ncc\Exceptions` in favor of `ConfigurationException` - Removed unused exception `InvalidScopeException` in `\ncc\Exceptions` in favor of `InvalidArgumentException` (standard php) - Removed unused exception `InvalidCredentialsEntryException` in `\ncc\Exceptions` (not used) - Removed unused exception `ComponentNotFoundException` in `\ncc\Exceptions` in favor of `ConfigurationException` - Removed unused exception `InvalidPackageNameException` in `\ncc\Exceptions` (not used) - Removed unused exception `InvalidVersionNumberException` in `\ncc\Exceptions` (not used) - Removed unused exception `InvalidProjectException` in `\ncc\Exceptions` in favor of `ConfigurationException` - Removed unused exception `InvalidProjectNameException` in `\ncc\Exceptions` in favor of `ConfigurationException` - Removed unused exception `BuildConfigurationNotFoundException` in `\ncc\Exceptions` in favor of `ConfigurationException`
This commit is contained in:
parent
c151d29b46
commit
0f08bd54d4
31 changed files with 258 additions and 668 deletions
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -110,6 +110,7 @@ features.
|
||||||
- Implemented interface `BytecodeObjectInterface` into `\ncc\Objects\ProjectConfiguration\Build > BuildConfiguration`
|
- Implemented interface `BytecodeObjectInterface` into `\ncc\Objects\ProjectConfiguration\Build > BuildConfiguration`
|
||||||
- Updated `\ncc\Classes > GitClient > cloneRepository()` to throw `GitException` instead of `GitCloneException`
|
- Updated `\ncc\Classes > GitClient > cloneRepository()` to throw `GitException` instead of `GitCloneException`
|
||||||
- Updated `\ncc\Classes > GitClient > checkout()` to throw `GitException` instead of `GitCheckoutException`
|
- Updated `\ncc\Classes > GitClient > checkout()` to throw `GitException` instead of `GitCheckoutException`
|
||||||
|
- Corrected code-smell and code style issues in `\ncc\Objects > PackageLock`
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
- Removed `FileNotFoundException` and `DirectoryNotFoundException` from `\ncc\Exceptions`
|
- Removed `FileNotFoundException` and `DirectoryNotFoundException` from `\ncc\Exceptions`
|
||||||
|
@ -130,6 +131,15 @@ features.
|
||||||
- Removed unused exception `UnsupportedPackageException` in `\ncc\Exceptions` (not used)
|
- Removed unused exception `UnsupportedPackageException` in `\ncc\Exceptions` (not used)
|
||||||
- Removed unused exception `UnsupportedRemoteTypeSource` in `\ncc\Exceptions` (not used)
|
- Removed unused exception `UnsupportedRemoteTypeSource` in `\ncc\Exceptions` (not used)
|
||||||
- Removed unused exception `UnsupportedProjectTypeException` in `\ncc\Exceptions` (not used)
|
- Removed unused exception `UnsupportedProjectTypeException` in `\ncc\Exceptions` (not used)
|
||||||
|
- Removed unused exception `InvalidProjectConfigurationException` in `\ncc\Exceptions` in favor of `ConfigurationException`
|
||||||
|
- Removed unused exception `InvalidScopeException` in `\ncc\Exceptions` in favor of `InvalidArgumentException` (standard php)
|
||||||
|
- Removed unused exception `InvalidCredentialsEntryException` in `\ncc\Exceptions` (not used)
|
||||||
|
- Removed unused exception `ComponentNotFoundException` in `\ncc\Exceptions` in favor of `ConfigurationException`
|
||||||
|
- Removed unused exception `InvalidPackageNameException` in `\ncc\Exceptions` (not used)
|
||||||
|
- Removed unused exception `InvalidVersionNumberException` in `\ncc\Exceptions` (not used)
|
||||||
|
- Removed unused exception `InvalidProjectException` in `\ncc\Exceptions` in favor of `ConfigurationException`
|
||||||
|
- Removed unused exception `InvalidProjectNameException` in `\ncc\Exceptions` in favor of `ConfigurationException`
|
||||||
|
- Removed unused exception `BuildConfigurationNotFoundException` in `\ncc\Exceptions` in favor of `ConfigurationException`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
ConfigurationException
|
ConfigurationException
|
||||||
INVALID_PROJECT_CONFIGURATION
|
* INVALID_PROJECT_CONFIGURATION
|
||||||
INVALID_SCOPE
|
* INVALID_SCOPE
|
||||||
INVALID_CREDENTIALS_ENTRY
|
* INVALID_CREDENTIALS_ENTRY
|
||||||
COMPONENT_VERSION_NOT_FOUND
|
* COMPONENT_VERSION_NOT_FOUND
|
||||||
INVALID_PACKAGE_NAME
|
* INVALID_PACKAGE_NAME
|
||||||
INVALID_VERSION_NUMBER
|
* INVALID_VERSION_NUMBER
|
||||||
INVALID_PROJECT_NAME
|
* INVALID_PROJECT_NAME
|
||||||
BUILD_CONFIGURATION_NOT_FOUND
|
BUILD_CONFIGURATION_NOT_FOUND
|
||||||
INVALID_PROJECT_BUILD_CONFIGURATION
|
INVALID_PROJECT_BUILD_CONFIGURATION
|
||||||
INVALID_PROPERTY_VALUE
|
INVALID_PROPERTY_VALUE
|
||||||
|
|
|
@ -1,30 +1,30 @@
|
||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Nosial 2022-2023, all rights reserved.
|
* 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
|
* 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
|
* 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
|
* 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
|
* Software, and to permit persons to whom the Software is furnished to do so, subject to the following
|
||||||
* conditions:
|
* conditions:
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions
|
* The above copyright notice and this permission notice shall be included in all copies or substantial portions
|
||||||
* of the Software.
|
* of the Software.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
* 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
|
* 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
|
* 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
|
* 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
|
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace ncc\CLI\Management;
|
namespace ncc\CLI\Management;
|
||||||
|
|
||||||
|
use JsonException;
|
||||||
use ncc\Enums\Scopes;
|
use ncc\Enums\Scopes;
|
||||||
use ncc\Exceptions\AccessDeniedException;
|
use ncc\Exceptions\AccessDeniedException;
|
||||||
use ncc\Exceptions\InvalidScopeException;
|
|
||||||
use ncc\Exceptions\IOException;
|
use ncc\Exceptions\IOException;
|
||||||
use ncc\Managers\ConfigurationManager;
|
use ncc\Managers\ConfigurationManager;
|
||||||
use ncc\Objects\CliHelpSection;
|
use ncc\Objects\CliHelpSection;
|
||||||
|
@ -42,7 +42,6 @@ namespace ncc\CLI\Management;
|
||||||
* @return void
|
* @return void
|
||||||
* @throws AccessDeniedException
|
* @throws AccessDeniedException
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws InvalidScopeException
|
|
||||||
*/
|
*/
|
||||||
public static function start($args): void
|
public static function start($args): void
|
||||||
{
|
{
|
||||||
|
@ -55,7 +54,8 @@ namespace ncc\CLI\Management;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$handle = fopen($sample_file, 'r');
|
$handle = fopen($sample_file, 'rb');
|
||||||
|
|
||||||
if (!$handle)
|
if (!$handle)
|
||||||
{
|
{
|
||||||
Console::outError('Cannot display sample, error reading template_config.yaml', true, 1);
|
Console::outError('Cannot display sample, error reading template_config.yaml', true, 1);
|
||||||
|
@ -79,7 +79,7 @@ namespace ncc\CLI\Management;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$handle = fopen(PathFinder::getConfigurationFile(), 'r');
|
$handle = fopen(PathFinder::getConfigurationFile(), 'rb');
|
||||||
if (!$handle)
|
if (!$handle)
|
||||||
{
|
{
|
||||||
Console::outError('Cannot display configuration file, error reading file', true, 1);
|
Console::outError('Cannot display configuration file, error reading file', true, 1);
|
||||||
|
@ -107,32 +107,44 @@ namespace ncc\CLI\Management;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strtolower($args['v']) == 'null')
|
if(strtolower($args['v']) === 'null')
|
||||||
|
{
|
||||||
$args['v'] = null;
|
$args['v'] = null;
|
||||||
|
}
|
||||||
|
|
||||||
if($configuration_manager->updateProperty($args['p'], $args['v']))
|
if($configuration_manager->updateProperty($args['p'], $args['v']))
|
||||||
{
|
{
|
||||||
$configuration_manager->save();
|
$configuration_manager->save();
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
Console::outError(sprintf('Unknown property %s', $args['p']), true, 1);
|
||||||
Console::outError(sprintf('Unknown property %s', $args['p']), true, 1);
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
$value = $configuration_manager->getProperty($args['p']);
|
||||||
|
if(!is_null($value))
|
||||||
{
|
{
|
||||||
$value = $configuration_manager->getProperty($args['p']);
|
if(is_bool($value))
|
||||||
if(!is_null($value))
|
|
||||||
{
|
{
|
||||||
if(is_bool($value))
|
$value = ($value ? 'true' : 'false');
|
||||||
$value = ($value ? 'true' : 'false');
|
|
||||||
if(is_array($value))
|
|
||||||
$value = json_encode($value, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT);
|
|
||||||
Console::out((string)$value);
|
|
||||||
}
|
}
|
||||||
exit(0);
|
|
||||||
|
if(is_array($value))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$value = json_encode($value, JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT);
|
||||||
|
}
|
||||||
|
catch(JsonException $e)
|
||||||
|
{
|
||||||
|
Console::outException(sprintf('Failed to encode array: %s', $e->getMessage()), $e, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Console::out((string)$value);
|
||||||
}
|
}
|
||||||
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
self::displayOptions();
|
self::displayOptions();
|
||||||
|
|
|
@ -26,9 +26,7 @@
|
||||||
use ncc\Enums\CompilerExtensionDefaultVersions;
|
use ncc\Enums\CompilerExtensionDefaultVersions;
|
||||||
use ncc\Enums\CompilerExtensions;
|
use ncc\Enums\CompilerExtensions;
|
||||||
use ncc\Enums\CompilerExtensionSupportedVersions;
|
use ncc\Enums\CompilerExtensionSupportedVersions;
|
||||||
use ncc\Exceptions\AccessDeniedException;
|
use ncc\Exceptions\ConfigurationException;
|
||||||
use ncc\Exceptions\InvalidPackageNameException;
|
|
||||||
use ncc\Exceptions\InvalidProjectNameException;
|
|
||||||
use ncc\Exceptions\IOException;
|
use ncc\Exceptions\IOException;
|
||||||
use ncc\Exceptions\MalformedJsonException;
|
use ncc\Exceptions\MalformedJsonException;
|
||||||
use ncc\Exceptions\PathNotFoundException;
|
use ncc\Exceptions\PathNotFoundException;
|
||||||
|
@ -47,7 +45,6 @@
|
||||||
*
|
*
|
||||||
* @param $args
|
* @param $args
|
||||||
* @return void
|
* @return void
|
||||||
* @throws AccessDeniedException
|
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws MalformedJsonException
|
* @throws MalformedJsonException
|
||||||
* @throws PathNotFoundException
|
* @throws PathNotFoundException
|
||||||
|
@ -64,19 +61,19 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Creates a new project
|
||||||
|
*
|
||||||
* @param $args
|
* @param $args
|
||||||
* @return void
|
* @return void
|
||||||
* @throws AccessDeniedException
|
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws MalformedJsonException
|
* @throws MalformedJsonException
|
||||||
* @throws ProjectConfigurationNotFoundException
|
|
||||||
* @throws PathNotFoundException
|
* @throws PathNotFoundException
|
||||||
|
* @throws ProjectConfigurationNotFoundException
|
||||||
*/
|
*/
|
||||||
public static function createProject($args): void
|
public static function createProject($args): void
|
||||||
{
|
{
|
||||||
// First determine the source directory of the project
|
// First determine the source directory of the project
|
||||||
$current_directory = getcwd();
|
$current_directory = getcwd();
|
||||||
$real_src = $current_directory;
|
|
||||||
if(isset($args['src']))
|
if(isset($args['src']))
|
||||||
{
|
{
|
||||||
// Make sure directory separators are corrected
|
// Make sure directory separators are corrected
|
||||||
|
@ -84,7 +81,7 @@
|
||||||
$args['src'] = str_ireplace('\\', DIRECTORY_SEPARATOR, $args['src']);
|
$args['src'] = str_ireplace('\\', DIRECTORY_SEPARATOR, $args['src']);
|
||||||
|
|
||||||
// Remove the trailing slash
|
// Remove the trailing slash
|
||||||
if(substr($args['src'], -1) == DIRECTORY_SEPARATOR)
|
if(substr($args['src'], -1) === DIRECTORY_SEPARATOR)
|
||||||
{
|
{
|
||||||
$args['src'] = substr($args['src'], 0, -1);
|
$args['src'] = substr($args['src'], 0, -1);
|
||||||
}
|
}
|
||||||
|
@ -216,14 +213,9 @@
|
||||||
{
|
{
|
||||||
$ProjectManager->initializeProject($Compiler, $project_name, $package_name, $real_src);
|
$ProjectManager->initializeProject($Compiler, $project_name, $package_name, $real_src);
|
||||||
}
|
}
|
||||||
catch (InvalidPackageNameException $e)
|
catch (ConfigurationException $e)
|
||||||
{
|
{
|
||||||
Console::outException('The given package name is invalid, the value must follow the standard package naming convention', $e, 1);
|
Console::outException(sprintf('The project configuration is invalid: %s', $e->getMessage()), $e, 1);
|
||||||
return;
|
|
||||||
}
|
|
||||||
catch (InvalidProjectNameException $e)
|
|
||||||
{
|
|
||||||
Console::outException('The given project name is invalid, cannot be empty or larger than 126 characters', $e, 1);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch (ProjectAlreadyExistsException $e)
|
catch (ProjectAlreadyExistsException $e)
|
||||||
|
|
|
@ -28,16 +28,6 @@
|
||||||
*/
|
*/
|
||||||
final class ExceptionCodes
|
final class ExceptionCodes
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @see InvalidProjectConfigurationException
|
|
||||||
*/
|
|
||||||
public const INVALID_PROJECT_CONFIGURATION = -1700;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see InvalidScopeException
|
|
||||||
*/
|
|
||||||
public const INVALID_SCOPE = -1703;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see AccessDeniedException
|
* @see AccessDeniedException
|
||||||
*/
|
*/
|
||||||
|
@ -53,36 +43,16 @@
|
||||||
*/
|
*/
|
||||||
public const RUNTIME = -1706;
|
public const RUNTIME = -1706;
|
||||||
|
|
||||||
/**
|
|
||||||
* @see InvalidCredentialsEntryException
|
|
||||||
*/
|
|
||||||
public const INVALID_CREDENTIALS_ENTRY = -1707;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ComponentVersionNotFoundException
|
|
||||||
*/
|
|
||||||
public const COMPONENT_VERSION_NOT_FOUND = -1708;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see ConstantReadonlyException
|
* @see ConstantReadonlyException
|
||||||
*/
|
*/
|
||||||
public const CONSTANT_READ_ONLY = -1709;
|
public const CONSTANT_READ_ONLY = -1709;
|
||||||
|
|
||||||
/**
|
|
||||||
* @see InvalidPackageNameException
|
|
||||||
*/
|
|
||||||
public const INVALID_PACKAGE_NAME = -1710;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see InvalidVersionNumberException
|
* @see InvalidVersionNumberException
|
||||||
*/
|
*/
|
||||||
public const INVALID_VERSION_NUMBER = -1711;
|
public const INVALID_VERSION_NUMBER = -1711;
|
||||||
|
|
||||||
/**
|
|
||||||
* @see InvalidProjectNameException
|
|
||||||
*/
|
|
||||||
public const INVALID_PROJECT_NAME = -1712;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see ProjectAlreadyExistsException
|
* @see ProjectAlreadyExistsException
|
||||||
*/
|
*/
|
||||||
|
@ -98,11 +68,6 @@
|
||||||
*/
|
*/
|
||||||
public const NO_UNITS_FOUND = -1715;
|
public const NO_UNITS_FOUND = -1715;
|
||||||
|
|
||||||
/**
|
|
||||||
* @see InvalidPackageException
|
|
||||||
*/
|
|
||||||
public const INVALID_PACKAGE = -1718;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see InvalidConstantNameException
|
* @see InvalidConstantNameException
|
||||||
*/
|
*/
|
||||||
|
@ -128,11 +93,6 @@
|
||||||
*/
|
*/
|
||||||
public const INVALID_PROPERTY_VALUE = -1724;
|
public const INVALID_PROPERTY_VALUE = -1724;
|
||||||
|
|
||||||
/**
|
|
||||||
* @see InvalidVersionConfigurationException
|
|
||||||
*/
|
|
||||||
public const INVALID_VERSION_CONFIGURATION = -1725;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see BuildException
|
* @see BuildException
|
||||||
*/
|
*/
|
||||||
|
@ -273,11 +233,6 @@
|
||||||
*/
|
*/
|
||||||
public const PACKAGE_FETCH_EXCEPTION = -1765;
|
public const PACKAGE_FETCH_EXCEPTION = -1765;
|
||||||
|
|
||||||
/**
|
|
||||||
* @see InvalidBuildConfigurationException
|
|
||||||
*/
|
|
||||||
public const INVALID_BUILD_CONFIGURATION = -1766;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see InvalidDependencyConfiguration
|
* @see InvalidDependencyConfiguration
|
||||||
*/
|
*/
|
||||||
|
@ -303,31 +258,28 @@
|
||||||
*/
|
*/
|
||||||
public const RESOURCE_NOT_FOUND = -1771;
|
public const RESOURCE_NOT_FOUND = -1771;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see ConfigurationException
|
||||||
|
*/
|
||||||
|
public const CONFIGURATION_EXCEPTION = -1772;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All the exception codes from NCC
|
* All the exception codes from NCC
|
||||||
*/
|
*/
|
||||||
public const All = [
|
public const All = [
|
||||||
self::INVALID_PROJECT_CONFIGURATION,
|
|
||||||
self::INVALID_SCOPE,
|
|
||||||
self::ACCESS_DENIED,
|
self::ACCESS_DENIED,
|
||||||
self::MALFORMED_JSON,
|
self::MALFORMED_JSON,
|
||||||
self::RUNTIME,
|
self::RUNTIME,
|
||||||
self::INVALID_CREDENTIALS_ENTRY,
|
|
||||||
self::COMPONENT_VERSION_NOT_FOUND,
|
|
||||||
self::CONSTANT_READ_ONLY,
|
self::CONSTANT_READ_ONLY,
|
||||||
self::INVALID_PACKAGE_NAME,
|
|
||||||
self::INVALID_VERSION_NUMBER,
|
self::INVALID_VERSION_NUMBER,
|
||||||
self::INVALID_PROJECT_NAME,
|
|
||||||
self::PROJECT_ALREADY_EXISTS,
|
self::PROJECT_ALREADY_EXISTS,
|
||||||
self::AUTOLOAD_GENERATOR,
|
self::AUTOLOAD_GENERATOR,
|
||||||
self::NO_UNITS_FOUND,
|
self::NO_UNITS_FOUND,
|
||||||
self::INVALID_PACKAGE,
|
|
||||||
self::INVALID_CONSTANT_NAME,
|
self::INVALID_CONSTANT_NAME,
|
||||||
self::PACKAGE_PREPARATION_FAILED,
|
self::PACKAGE_PREPARATION_FAILED,
|
||||||
self::BUILD_CONFIGURATION_NOT_FOUND,
|
self::BUILD_CONFIGURATION_NOT_FOUND,
|
||||||
self::INVALID_PROJECT_BUILD_CONFIGURATION,
|
self::INVALID_PROJECT_BUILD_CONFIGURATION,
|
||||||
self::INVALID_PROPERTY_VALUE,
|
self::INVALID_PROPERTY_VALUE,
|
||||||
self::INVALID_VERSION_CONFIGURATION,
|
|
||||||
self::BUILD_EXCEPTION,
|
self::BUILD_EXCEPTION,
|
||||||
self::PACKAGE_PARSING_EXCEPTION,
|
self::PACKAGE_PARSING_EXCEPTION,
|
||||||
self::PACKAGE_LOCK_EXCEPTION,
|
self::PACKAGE_LOCK_EXCEPTION,
|
||||||
|
@ -354,11 +306,11 @@
|
||||||
self::NOT_SUPPORTED_EXCEPTION,
|
self::NOT_SUPPORTED_EXCEPTION,
|
||||||
self::ARCHIVE_EXCEPTION,
|
self::ARCHIVE_EXCEPTION,
|
||||||
self::PACKAGE_FETCH_EXCEPTION,
|
self::PACKAGE_FETCH_EXCEPTION,
|
||||||
self::INVALID_BUILD_CONFIGURATION,
|
|
||||||
self::INVALID_DEPENDENCY_CONFIGURATION,
|
self::INVALID_DEPENDENCY_CONFIGURATION,
|
||||||
self::SYMLINK_EXCEPTION,
|
self::SYMLINK_EXCEPTION,
|
||||||
self::PATH_NOT_FOUND,
|
self::PATH_NOT_FOUND,
|
||||||
self::GIT_EXCEPTION,
|
self::GIT_EXCEPTION,
|
||||||
self::RESOURCE_NOT_FOUND,
|
self::RESOURCE_NOT_FOUND,
|
||||||
|
self::CONFIGURATION_EXCEPTION
|
||||||
];
|
];
|
||||||
}
|
}
|
|
@ -1,39 +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\Exceptions;
|
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use ncc\Enums\ExceptionCodes;
|
|
||||||
use Throwable;
|
|
||||||
|
|
||||||
class ComponentVersionNotFoundException extends Exception
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @param string $message
|
|
||||||
* @param Throwable|null $previous
|
|
||||||
*/
|
|
||||||
public function __construct(string $message = "", ?Throwable $previous = null)
|
|
||||||
{
|
|
||||||
parent::__construct($message, ExceptionCodes::COMPONENT_VERSION_NOT_FOUND, $previous);
|
|
||||||
}
|
|
||||||
}
|
|
39
src/ncc/Exceptions/ConfigurationException.php
Normal file
39
src/ncc/Exceptions/ConfigurationException.php
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
<?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\Exceptions;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
|
use ncc\Enums\ExceptionCodes;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
class ConfigurationException extends Exception
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param string $message
|
||||||
|
* @param Throwable|null $previous
|
||||||
|
*/
|
||||||
|
public function __construct(string $message = "", ?Throwable $previous = null)
|
||||||
|
{
|
||||||
|
parent::__construct($message, ExceptionCodes::CONFIGURATION_EXCEPTION, $previous);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,39 +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\Exceptions;
|
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use ncc\Enums\ExceptionCodes;
|
|
||||||
use Throwable;
|
|
||||||
|
|
||||||
class InvalidBuildConfigurationException extends Exception
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @param string $message
|
|
||||||
* @param Throwable|null $previous
|
|
||||||
*/
|
|
||||||
public function __construct(string $message = "", ?Throwable $previous = null)
|
|
||||||
{
|
|
||||||
parent::__construct($message, ExceptionCodes::INVALID_BUILD_CONFIGURATION, $previous);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,39 +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\Exceptions;
|
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use ncc\Enums\ExceptionCodes;
|
|
||||||
use Throwable;
|
|
||||||
|
|
||||||
class InvalidCredentialsEntryException extends Exception
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @param string $message
|
|
||||||
* @param Throwable|null $previous
|
|
||||||
*/
|
|
||||||
public function __construct(string $message = "", ?Throwable $previous = null)
|
|
||||||
{
|
|
||||||
parent::__construct($message, ExceptionCodes::INVALID_CREDENTIALS_ENTRY, $previous);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,39 +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\Exceptions;
|
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use ncc\Enums\ExceptionCodes;
|
|
||||||
use Throwable;
|
|
||||||
|
|
||||||
class InvalidPackageException extends Exception
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @param string $message
|
|
||||||
* @param Throwable|null $previous
|
|
||||||
*/
|
|
||||||
public function __construct(string $message = "", ?Throwable $previous = null)
|
|
||||||
{
|
|
||||||
parent::__construct($message, ExceptionCodes::INVALID_PACKAGE, $previous);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,39 +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\Exceptions;
|
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use ncc\Enums\ExceptionCodes;
|
|
||||||
use Throwable;
|
|
||||||
|
|
||||||
class InvalidPackageNameException extends Exception
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @param string $message
|
|
||||||
* @param Throwable|null $previous
|
|
||||||
*/
|
|
||||||
public function __construct(string $message = "", ?Throwable $previous = null)
|
|
||||||
{
|
|
||||||
parent::__construct($message, ExceptionCodes::INVALID_PACKAGE_NAME, $previous);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,58 +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\Exceptions;
|
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use ncc\Enums\ExceptionCodes;
|
|
||||||
use Throwable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Zi Xing Narrakas
|
|
||||||
* @copyright Copyright (C) 2022-2022. Nosial - All Rights Reserved.
|
|
||||||
*/
|
|
||||||
class InvalidProjectConfigurationException extends Exception
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var string|null
|
|
||||||
*/
|
|
||||||
private ?string $property;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $message
|
|
||||||
* @param string|null $property
|
|
||||||
* @param Throwable|null $previous
|
|
||||||
*/
|
|
||||||
public function __construct(string $message = "", ?string $property=null, ?Throwable $previous = null)
|
|
||||||
{
|
|
||||||
parent::__construct($message, ExceptionCodes::INVALID_PROJECT_CONFIGURATION, $previous);
|
|
||||||
$this->property = $property;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string|null
|
|
||||||
*/
|
|
||||||
public function getProperty(): ?string
|
|
||||||
{
|
|
||||||
return $this->property;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,39 +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\Exceptions;
|
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use ncc\Enums\ExceptionCodes;
|
|
||||||
use Throwable;
|
|
||||||
|
|
||||||
class InvalidProjectNameException extends Exception
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @param string $message
|
|
||||||
* @param Throwable|null $previous
|
|
||||||
*/
|
|
||||||
public function __construct(string $message = "", ?Throwable $previous = null)
|
|
||||||
{
|
|
||||||
parent::__construct($message, ExceptionCodes::INVALID_PROJECT_NAME, $previous);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,39 +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\Exceptions;
|
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use ncc\Enums\ExceptionCodes;
|
|
||||||
use Throwable;
|
|
||||||
|
|
||||||
class InvalidScopeException extends Exception
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @param string $scope
|
|
||||||
* @param Throwable|null $previous
|
|
||||||
*/
|
|
||||||
public function __construct(string $scope = "", ?Throwable $previous = null)
|
|
||||||
{
|
|
||||||
parent::__construct('The given scope \'' . $scope . '\' is not valid', ExceptionCodes::INVALID_SCOPE, $previous);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,39 +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\Exceptions;
|
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use ncc\Enums\ExceptionCodes;
|
|
||||||
use Throwable;
|
|
||||||
|
|
||||||
class InvalidVersionConfigurationException extends Exception
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @param string $message
|
|
||||||
* @param Throwable|null $previous
|
|
||||||
*/
|
|
||||||
public function __construct(string $message = "", ?Throwable $previous = null)
|
|
||||||
{
|
|
||||||
parent::__construct($message, ExceptionCodes::INVALID_VERSION_CONFIGURATION, $previous);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -27,8 +27,8 @@
|
||||||
use Exception;
|
use Exception;
|
||||||
use ncc\Enums\Scopes;
|
use ncc\Enums\Scopes;
|
||||||
use ncc\Exceptions\AccessDeniedException;
|
use ncc\Exceptions\AccessDeniedException;
|
||||||
use ncc\Exceptions\InvalidScopeException;
|
|
||||||
use ncc\Exceptions\IOException;
|
use ncc\Exceptions\IOException;
|
||||||
|
use ncc\Exceptions\PathNotFoundException;
|
||||||
use ncc\ThirdParty\Symfony\Yaml\Yaml;
|
use ncc\ThirdParty\Symfony\Yaml\Yaml;
|
||||||
use ncc\Utilities\Console;
|
use ncc\Utilities\Console;
|
||||||
use ncc\Utilities\Functions;
|
use ncc\Utilities\Functions;
|
||||||
|
@ -47,9 +47,8 @@
|
||||||
private $configuration;
|
private $configuration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws AccessDeniedException
|
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws InvalidScopeException
|
* @throws PathNotFoundException
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
@ -60,9 +59,8 @@
|
||||||
* Loads the configuration file if it exists
|
* Loads the configuration file if it exists
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @throws AccessDeniedException
|
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws InvalidScopeException
|
* @throws PathNotFoundException
|
||||||
*/
|
*/
|
||||||
public function load(): void
|
public function load(): void
|
||||||
{
|
{
|
||||||
|
@ -86,7 +84,6 @@
|
||||||
* @return void
|
* @return void
|
||||||
* @throws AccessDeniedException
|
* @throws AccessDeniedException
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws InvalidScopeException
|
|
||||||
*/
|
*/
|
||||||
public function save(): void
|
public function save(): void
|
||||||
{
|
{
|
||||||
|
@ -147,7 +144,6 @@
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws AccessDeniedException
|
* @throws AccessDeniedException
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws InvalidScopeException
|
|
||||||
*/
|
*/
|
||||||
public function updateProperty(string $property, $value): bool
|
public function updateProperty(string $property, $value): bool
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Nosial 2022-2023, all rights reserved.
|
* 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
|
* 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
|
* 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
|
* 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
|
* Software, and to permit persons to whom the Software is furnished to do so, subject to the following
|
||||||
* conditions:
|
* conditions:
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions
|
* The above copyright notice and this permission notice shall be included in all copies or substantial portions
|
||||||
* of the Software.
|
* of the Software.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
* 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
|
* 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
|
* 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
|
* 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
|
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @noinspection PhpMissingFieldTypeInspection */
|
/** @noinspection PhpMissingFieldTypeInspection */
|
||||||
|
|
||||||
|
@ -40,8 +40,6 @@
|
||||||
use ncc\CLI\Main;
|
use ncc\CLI\Main;
|
||||||
use ncc\Exceptions\AccessDeniedException;
|
use ncc\Exceptions\AccessDeniedException;
|
||||||
use ncc\Exceptions\InstallationException;
|
use ncc\Exceptions\InstallationException;
|
||||||
use ncc\Exceptions\InvalidPackageNameException;
|
|
||||||
use ncc\Exceptions\InvalidScopeException;
|
|
||||||
use ncc\Exceptions\IOException;
|
use ncc\Exceptions\IOException;
|
||||||
use ncc\Exceptions\MissingDependencyException;
|
use ncc\Exceptions\MissingDependencyException;
|
||||||
use ncc\Exceptions\NotSupportedException;
|
use ncc\Exceptions\NotSupportedException;
|
||||||
|
@ -108,8 +106,6 @@
|
||||||
* @throws AccessDeniedException
|
* @throws AccessDeniedException
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws InstallationException
|
* @throws InstallationException
|
||||||
* @throws InvalidPackageNameException
|
|
||||||
* @throws InvalidScopeException
|
|
||||||
* @throws MissingDependencyException
|
* @throws MissingDependencyException
|
||||||
* @throws NotSupportedException
|
* @throws NotSupportedException
|
||||||
* @throws PackageAlreadyInstalledException
|
* @throws PackageAlreadyInstalledException
|
||||||
|
@ -655,8 +651,6 @@
|
||||||
* @throws AccessDeniedException
|
* @throws AccessDeniedException
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws InstallationException
|
* @throws InstallationException
|
||||||
* @throws InvalidPackageNameException
|
|
||||||
* @throws InvalidScopeException
|
|
||||||
* @throws MissingDependencyException
|
* @throws MissingDependencyException
|
||||||
* @throws NotSupportedException
|
* @throws NotSupportedException
|
||||||
* @throws PackageAlreadyInstalledException
|
* @throws PackageAlreadyInstalledException
|
||||||
|
|
|
@ -31,10 +31,10 @@
|
||||||
use ncc\Exceptions\AccessDeniedException;
|
use ncc\Exceptions\AccessDeniedException;
|
||||||
use ncc\Exceptions\BuildConfigurationNotFoundException;
|
use ncc\Exceptions\BuildConfigurationNotFoundException;
|
||||||
use ncc\Exceptions\BuildException;
|
use ncc\Exceptions\BuildException;
|
||||||
use ncc\Exceptions\InvalidPackageNameException;
|
use ncc\Exceptions\ConfigurationException;
|
||||||
use ncc\Exceptions\InvalidProjectNameException;
|
|
||||||
use ncc\Exceptions\IOException;
|
use ncc\Exceptions\IOException;
|
||||||
use ncc\Exceptions\MalformedJsonException;
|
use ncc\Exceptions\MalformedJsonException;
|
||||||
|
use ncc\Exceptions\NotSupportedException;
|
||||||
use ncc\Exceptions\PathNotFoundException;
|
use ncc\Exceptions\PathNotFoundException;
|
||||||
use ncc\Exceptions\ProjectAlreadyExistsException;
|
use ncc\Exceptions\ProjectAlreadyExistsException;
|
||||||
use ncc\Exceptions\ProjectConfigurationNotFoundException;
|
use ncc\Exceptions\ProjectConfigurationNotFoundException;
|
||||||
|
@ -71,7 +71,6 @@
|
||||||
* Public Constructor
|
* Public Constructor
|
||||||
*
|
*
|
||||||
* @param string $path
|
* @param string $path
|
||||||
* @throws AccessDeniedException
|
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws MalformedJsonException
|
* @throws MalformedJsonException
|
||||||
* @throws PathNotFoundException
|
* @throws PathNotFoundException
|
||||||
|
@ -108,8 +107,7 @@
|
||||||
* @param string $package
|
* @param string $package
|
||||||
* @param string|null $src
|
* @param string|null $src
|
||||||
* @param array $options
|
* @param array $options
|
||||||
* @throws InvalidPackageNameException
|
* @throws ConfigurationException
|
||||||
* @throws InvalidProjectNameException
|
|
||||||
* @throws MalformedJsonException
|
* @throws MalformedJsonException
|
||||||
* @throws ProjectAlreadyExistsException
|
* @throws ProjectAlreadyExistsException
|
||||||
*/
|
*/
|
||||||
|
@ -118,12 +116,12 @@
|
||||||
// Validate the project information first
|
// Validate the project information first
|
||||||
if(!Validate::packageName($package))
|
if(!Validate::packageName($package))
|
||||||
{
|
{
|
||||||
throw new InvalidPackageNameException('The given package name \'' . $package . '\' is not a valid package name');
|
throw new ConfigurationException('The given package name \'' . $package . '\' is not a valid package name');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!Validate::projectName($name))
|
if(!Validate::projectName($name))
|
||||||
{
|
{
|
||||||
throw new InvalidProjectNameException('The given project name \'' . $name . '\' is not valid');
|
throw new ConfigurationException('The given project name \'' . $name . '\' is not valid');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(file_exists($this->project_path . DIRECTORY_SEPARATOR . 'project.json'))
|
if(file_exists($this->project_path . DIRECTORY_SEPARATOR . 'project.json'))
|
||||||
|
@ -217,7 +215,6 @@
|
||||||
* Attempts to load the project configuration
|
* Attempts to load the project configuration
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @throws AccessDeniedException
|
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws MalformedJsonException
|
* @throws MalformedJsonException
|
||||||
* @throws PathNotFoundException
|
* @throws PathNotFoundException
|
||||||
|
@ -253,7 +250,6 @@
|
||||||
* Returns the ProjectConfiguration object
|
* Returns the ProjectConfiguration object
|
||||||
*
|
*
|
||||||
* @return ProjectConfiguration
|
* @return ProjectConfiguration
|
||||||
* @throws AccessDeniedException
|
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws MalformedJsonException
|
* @throws MalformedJsonException
|
||||||
* @throws PathNotFoundException
|
* @throws PathNotFoundException
|
||||||
|
@ -292,6 +288,7 @@
|
||||||
* @throws MalformedJsonException
|
* @throws MalformedJsonException
|
||||||
* @throws PathNotFoundException
|
* @throws PathNotFoundException
|
||||||
* @throws ProjectConfigurationNotFoundException
|
* @throws ProjectConfigurationNotFoundException
|
||||||
|
* @throws NotSupportedException
|
||||||
*/
|
*/
|
||||||
public function build(string $build_configuration=BuildConfigurationValues::DEFAULT): string
|
public function build(string $build_configuration=BuildConfigurationValues::DEFAULT): string
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use ncc\Enums\Scopes;
|
use ncc\Enums\Scopes;
|
||||||
use ncc\Exceptions\InvalidScopeException;
|
|
||||||
use ncc\Exceptions\IOException;
|
use ncc\Exceptions\IOException;
|
||||||
use ncc\Objects\DefinedRemoteSource;
|
use ncc\Objects\DefinedRemoteSource;
|
||||||
use ncc\Utilities\IO;
|
use ncc\Utilities\IO;
|
||||||
|
@ -52,12 +51,10 @@
|
||||||
/**
|
/**
|
||||||
* Public Constructor
|
* Public Constructor
|
||||||
*
|
*
|
||||||
* @throws InvalidScopeException
|
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->DefinedSourcesPath = PathFinder::getRemoteSources(Scopes::SYSTEM);
|
$this->DefinedSourcesPath = PathFinder::getRemoteSources(Scopes::SYSTEM);
|
||||||
|
|
||||||
$this->load();
|
$this->load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,10 +24,10 @@
|
||||||
|
|
||||||
namespace ncc\Objects\NccVersionInformation;
|
namespace ncc\Objects\NccVersionInformation;
|
||||||
|
|
||||||
use ncc\Exceptions\AccessDeniedException;
|
|
||||||
use ncc\Exceptions\ComponentVersionNotFoundException;
|
|
||||||
use ncc\Exceptions\IOException;
|
use ncc\Exceptions\IOException;
|
||||||
|
use ncc\Exceptions\PathNotFoundException;
|
||||||
use ncc\Utilities\IO;
|
use ncc\Utilities\IO;
|
||||||
|
use RuntimeException;
|
||||||
|
|
||||||
class Component
|
class Component
|
||||||
{
|
{
|
||||||
|
@ -49,9 +49,8 @@
|
||||||
* Attempts to resolve the component's build version
|
* Attempts to resolve the component's build version
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
* @throws ComponentVersionNotFoundException
|
|
||||||
* @throws AccessDeniedException
|
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
|
* @throws PathNotFoundException
|
||||||
*/
|
*/
|
||||||
public function getVersion(): string
|
public function getVersion(): string
|
||||||
{
|
{
|
||||||
|
@ -60,7 +59,7 @@
|
||||||
|
|
||||||
if(!file_exists($component_path . 'VERSION'))
|
if(!file_exists($component_path . 'VERSION'))
|
||||||
{
|
{
|
||||||
throw new ComponentVersionNotFoundException('The file \'' . $component_path . 'VERSION' . '\' does not exist');
|
throw new RuntimeException(sprintf('Component %s/%s does not have a VERSION stub file', $this->vendor, $this->package_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
return IO::fread($component_path . 'VERSION');
|
return IO::fread($component_path . 'VERSION');
|
||||||
|
|
|
@ -27,8 +27,7 @@
|
||||||
use Exception;
|
use Exception;
|
||||||
use ncc\Enums\EncoderType;
|
use ncc\Enums\EncoderType;
|
||||||
use ncc\Enums\PackageStructureVersions;
|
use ncc\Enums\PackageStructureVersions;
|
||||||
use ncc\Exceptions\InvalidPackageException;
|
use ncc\Exceptions\ConfigurationException;
|
||||||
use ncc\Exceptions\InvalidProjectConfigurationException;
|
|
||||||
use ncc\Exceptions\IOException;
|
use ncc\Exceptions\IOException;
|
||||||
use ncc\Exceptions\PackageParsingException;
|
use ncc\Exceptions\PackageParsingException;
|
||||||
use ncc\Exceptions\PathNotFoundException;
|
use ncc\Exceptions\PathNotFoundException;
|
||||||
|
@ -170,8 +169,7 @@
|
||||||
*
|
*
|
||||||
* @param bool $throw_exception
|
* @param bool $throw_exception
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws InvalidPackageException
|
* @throws ConfigurationException
|
||||||
* @throws InvalidProjectConfigurationException
|
|
||||||
*/
|
*/
|
||||||
public function validate(bool $throw_exception=True): bool
|
public function validate(bool $throw_exception=True): bool
|
||||||
{
|
{
|
||||||
|
@ -180,7 +178,7 @@
|
||||||
{
|
{
|
||||||
if($throw_exception)
|
if($throw_exception)
|
||||||
{
|
{
|
||||||
throw new InvalidPackageException('The MagicBytes property is required and cannot be null');
|
throw new ConfigurationException('The MagicBytes property is required and cannot be null');
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -191,7 +189,7 @@
|
||||||
{
|
{
|
||||||
if($throw_exception)
|
if($throw_exception)
|
||||||
{
|
{
|
||||||
throw new InvalidPackageException('The Assembly property is required and cannot be null');
|
throw new ConfigurationException('The Assembly property is required and cannot be null');
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1,32 +1,30 @@
|
||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Nosial 2022-2023, all rights reserved.
|
* 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
|
* 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
|
* 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
|
* 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
|
* Software, and to permit persons to whom the Software is furnished to do so, subject to the following
|
||||||
* conditions:
|
* conditions:
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions
|
* The above copyright notice and this permission notice shall be included in all copies or substantial portions
|
||||||
* of the Software.
|
* of the Software.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
* 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
|
* 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
|
* 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
|
* 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
|
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @noinspection PhpMissingFieldTypeInspection */
|
/** @noinspection PhpMissingFieldTypeInspection */
|
||||||
|
|
||||||
namespace ncc\Objects;
|
namespace ncc\Objects;
|
||||||
|
|
||||||
use ncc\Enums\Versions;
|
use ncc\Enums\Versions;
|
||||||
use ncc\Exceptions\InvalidPackageNameException;
|
|
||||||
use ncc\Exceptions\InvalidScopeException;
|
|
||||||
use ncc\Exceptions\VersionNotFoundException;
|
use ncc\Exceptions\VersionNotFoundException;
|
||||||
use ncc\Objects\PackageLock\PackageEntry;
|
use ncc\Objects\PackageLock\PackageEntry;
|
||||||
use ncc\Utilities\Console;
|
use ncc\Utilities\Console;
|
||||||
|
@ -79,8 +77,6 @@
|
||||||
* @param Package $package
|
* @param Package $package
|
||||||
* @param string $install_path
|
* @param string $install_path
|
||||||
* @return void
|
* @return void
|
||||||
* @throws InvalidPackageNameException
|
|
||||||
* @throws InvalidScopeException
|
|
||||||
*/
|
*/
|
||||||
public function addPackage(Package $package, string $install_path): void
|
public function addPackage(Package $package, string $install_path): void
|
||||||
{
|
{
|
||||||
|
@ -121,7 +117,7 @@
|
||||||
$r = $this->Packages[$package]->removeVersion($version);
|
$r = $this->Packages[$package]->removeVersion($version);
|
||||||
|
|
||||||
// Remove the entire package entry if there's no installed versions
|
// Remove the entire package entry if there's no installed versions
|
||||||
if($this->Packages[$package]->getLatestVersion() == null && $r)
|
if($r && $this->Packages[$package]->getLatestVersion() === null)
|
||||||
{
|
{
|
||||||
unset($this->Packages[$package]);
|
unset($this->Packages[$package]);
|
||||||
}
|
}
|
||||||
|
@ -162,13 +158,7 @@
|
||||||
public function getPackage(string $package): ?PackageEntry
|
public function getPackage(string $package): ?PackageEntry
|
||||||
{
|
{
|
||||||
Console::outDebug(sprintf('getting package %s from package lock file', $package));
|
Console::outDebug(sprintf('getting package %s from package lock file', $package));
|
||||||
|
return $this->Packages[$package] ?? null;
|
||||||
if(isset($this->Packages[$package]))
|
|
||||||
{
|
|
||||||
return $this->Packages[$package];
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -181,8 +171,11 @@
|
||||||
public function packageExists(string $package, ?string $version=null): bool
|
public function packageExists(string $package, ?string $version=null): bool
|
||||||
{
|
{
|
||||||
$package_entry = $this->getPackage($package);
|
$package_entry = $this->getPackage($package);
|
||||||
if($package_entry == null)
|
|
||||||
|
if($package_entry === null)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if($version !== null)
|
if($version !== null)
|
||||||
{
|
{
|
||||||
|
@ -196,7 +189,7 @@
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($version_entry == null)
|
if($version_entry === null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -213,8 +206,12 @@
|
||||||
public function getPackages(): array
|
public function getPackages(): array
|
||||||
{
|
{
|
||||||
$results = [];
|
$results = [];
|
||||||
|
|
||||||
foreach($this->Packages as $package => $entry)
|
foreach($this->Packages as $package => $entry)
|
||||||
|
{
|
||||||
$results[$package] = $entry->getVersions();
|
$results[$package] = $entry->getVersions();
|
||||||
|
}
|
||||||
|
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
|
|
||||||
use ncc\Enums\Scopes;
|
use ncc\Enums\Scopes;
|
||||||
use ncc\Enums\Versions;
|
use ncc\Enums\Versions;
|
||||||
use ncc\Exceptions\InvalidPackageNameException;
|
use ncc\Exceptions\ConfigurationException;
|
||||||
use ncc\Exceptions\InvalidScopeException;
|
|
||||||
use ncc\Exceptions\VersionNotFoundException;
|
use ncc\Exceptions\VersionNotFoundException;
|
||||||
use ncc\Objects\Package;
|
use ncc\Objects\Package;
|
||||||
use ncc\Objects\ProjectConfiguration\UpdateSource;
|
use ncc\Objects\ProjectConfiguration\UpdateSource;
|
||||||
|
@ -246,8 +245,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
* @throws InvalidPackageNameException
|
* @throws ConfigurationException
|
||||||
* @throws InvalidScopeException
|
|
||||||
*/
|
*/
|
||||||
public function getDataPath(): string
|
public function getDataPath(): string
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,10 +27,9 @@
|
||||||
use Exception;
|
use Exception;
|
||||||
use ncc\Enums\Options\BuildConfigurationValues;
|
use ncc\Enums\Options\BuildConfigurationValues;
|
||||||
use ncc\Exceptions\BuildConfigurationNotFoundException;
|
use ncc\Exceptions\BuildConfigurationNotFoundException;
|
||||||
use ncc\Exceptions\InvalidBuildConfigurationException;
|
use ncc\Exceptions\ConfigurationException;
|
||||||
use ncc\Exceptions\InvalidConstantNameException;
|
use ncc\Exceptions\InvalidConstantNameException;
|
||||||
use ncc\Exceptions\InvalidProjectBuildConfiguration;
|
use ncc\Exceptions\InvalidProjectBuildConfiguration;
|
||||||
use ncc\Exceptions\InvalidProjectConfigurationException;
|
|
||||||
use ncc\Exceptions\InvalidPropertyValueException;
|
use ncc\Exceptions\InvalidPropertyValueException;
|
||||||
use ncc\Exceptions\IOException;
|
use ncc\Exceptions\IOException;
|
||||||
use ncc\Exceptions\MalformedJsonException;
|
use ncc\Exceptions\MalformedJsonException;
|
||||||
|
@ -104,13 +103,10 @@
|
||||||
* @param bool $throw_exception
|
* @param bool $throw_exception
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws BuildConfigurationNotFoundException
|
* @throws BuildConfigurationNotFoundException
|
||||||
* @throws InvalidConstantNameException
|
* @throws ConfigurationException
|
||||||
* @throws InvalidProjectBuildConfiguration
|
|
||||||
* @throws InvalidProjectConfigurationException
|
|
||||||
* @throws InvalidPropertyValueException
|
* @throws InvalidPropertyValueException
|
||||||
* @throws RuntimeException
|
* @throws RuntimeException
|
||||||
* @throws UndefinedExecutionPolicyException
|
* @throws UndefinedExecutionPolicyException
|
||||||
* @throws InvalidBuildConfigurationException
|
|
||||||
*/
|
*/
|
||||||
public function validate(bool $throw_exception=True): bool
|
public function validate(bool $throw_exception=True): bool
|
||||||
{
|
{
|
||||||
|
@ -180,7 +176,7 @@
|
||||||
{
|
{
|
||||||
if($throw_exception)
|
if($throw_exception)
|
||||||
{
|
{
|
||||||
throw new InvalidBuildConfigurationException(sprintf('Build configuration build.main cannot be set to "%s"', BuildConfigurationValues::ALL));
|
throw new ConfigurationException(sprintf('Build configuration build.main cannot be set to "%s"', BuildConfigurationValues::ALL));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
namespace ncc\Objects\ProjectConfiguration;
|
namespace ncc\Objects\ProjectConfiguration;
|
||||||
|
|
||||||
use ncc\Enums\RegexPatterns;
|
use ncc\Enums\RegexPatterns;
|
||||||
use ncc\Exceptions\InvalidProjectConfigurationException;
|
use ncc\Exceptions\ConfigurationException;
|
||||||
use ncc\Interfaces\BytecodeObjectInterface;
|
use ncc\Interfaces\BytecodeObjectInterface;
|
||||||
use ncc\Utilities\Functions;
|
use ncc\Utilities\Functions;
|
||||||
use ncc\Utilities\Validate;
|
use ncc\Utilities\Validate;
|
||||||
|
@ -102,7 +102,7 @@
|
||||||
*
|
*
|
||||||
* @param bool $throw_exception
|
* @param bool $throw_exception
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws InvalidProjectConfigurationException
|
* @throws ConfigurationException
|
||||||
*/
|
*/
|
||||||
public function validate(bool $throw_exception=True): bool
|
public function validate(bool $throw_exception=True): bool
|
||||||
{
|
{
|
||||||
|
@ -110,7 +110,7 @@
|
||||||
{
|
{
|
||||||
if($throw_exception)
|
if($throw_exception)
|
||||||
{
|
{
|
||||||
throw new InvalidProjectConfigurationException('The UUID is not a valid v4 UUID', 'Assembly.UUID');
|
throw new ConfigurationException(sprintf('The UUID is not a valid v4 UUID: %s, in property Assembly.UUID', $this->uuid));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -120,7 +120,7 @@
|
||||||
{
|
{
|
||||||
if($throw_exception)
|
if($throw_exception)
|
||||||
{
|
{
|
||||||
throw new InvalidProjectConfigurationException('The version number is invalid', 'Assembly.Version');
|
throw new ConfigurationException(sprintf('The version number is invalid: %s, in property Assembly.Version', $this->version));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -130,7 +130,7 @@
|
||||||
{
|
{
|
||||||
if($throw_exception)
|
if($throw_exception)
|
||||||
{
|
{
|
||||||
throw new InvalidProjectConfigurationException('The package name is invalid', 'Assembly.Package');
|
throw new ConfigurationException(sprintf('The package name is invalid: %s, in property Assembly.Package', $this->package));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -140,7 +140,7 @@
|
||||||
{
|
{
|
||||||
if($throw_exception)
|
if($throw_exception)
|
||||||
{
|
{
|
||||||
throw new InvalidProjectConfigurationException('The name cannot be larger than 126 characters', 'Assembly.Name');
|
throw new ConfigurationException(sprintf('The name cannot be larger than 126 characters: %s, in property Assembly.Name', $this->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -150,7 +150,7 @@
|
||||||
{
|
{
|
||||||
if($throw_exception)
|
if($throw_exception)
|
||||||
{
|
{
|
||||||
throw new InvalidProjectConfigurationException('The description cannot be larger than 512 characters', 'Assembly.Description');
|
throw new ConfigurationException(sprintf('The description cannot be larger than 512 characters: %s, in property Assembly.Description', $this->description));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -160,7 +160,7 @@
|
||||||
{
|
{
|
||||||
if($throw_exception)
|
if($throw_exception)
|
||||||
{
|
{
|
||||||
throw new InvalidProjectConfigurationException('The company cannot be larger than 126 characters', 'Assembly.Company');
|
throw new ConfigurationException(sprintf('The company cannot be larger than 126 characters: %s, in property Assembly.Company', $this->company));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -170,7 +170,7 @@
|
||||||
{
|
{
|
||||||
if($throw_exception)
|
if($throw_exception)
|
||||||
{
|
{
|
||||||
throw new InvalidProjectConfigurationException('The company cannot be larger than 256 characters', 'Assembly.Product');
|
throw new ConfigurationException(sprintf('The product cannot be larger than 256 characters: %s, in property Assembly.Product', $this->product));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -180,7 +180,7 @@
|
||||||
{
|
{
|
||||||
if($throw_exception)
|
if($throw_exception)
|
||||||
{
|
{
|
||||||
throw new InvalidProjectConfigurationException('The copyright cannot be larger than 256 characters', 'Assembly.Copyright');
|
throw new ConfigurationException(sprintf('The copyright cannot be larger than 256 characters: %s, in property Assembly.Copyright', $this->company));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -190,7 +190,7 @@
|
||||||
{
|
{
|
||||||
if($throw_exception)
|
if($throw_exception)
|
||||||
{
|
{
|
||||||
throw new InvalidProjectConfigurationException('The trademark cannot be larger than 256 characters', 'Assembly.Trademark');
|
throw new ConfigurationException(sprintf('The trademark cannot be larger than 256 characters: %s, in property Assembly.Trademark', $this->trademark));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -26,9 +26,7 @@
|
||||||
|
|
||||||
use ncc\Enums\Options\BuildConfigurationValues;
|
use ncc\Enums\Options\BuildConfigurationValues;
|
||||||
use ncc\Exceptions\BuildConfigurationNotFoundException;
|
use ncc\Exceptions\BuildConfigurationNotFoundException;
|
||||||
use ncc\Exceptions\InvalidBuildConfigurationException;
|
use ncc\Exceptions\ConfigurationException;
|
||||||
use ncc\Exceptions\InvalidConstantNameException;
|
|
||||||
use ncc\Exceptions\InvalidProjectBuildConfiguration;
|
|
||||||
use ncc\Interfaces\BytecodeObjectInterface;
|
use ncc\Interfaces\BytecodeObjectInterface;
|
||||||
use ncc\Objects\ProjectConfiguration\Build\BuildConfiguration;
|
use ncc\Objects\ProjectConfiguration\Build\BuildConfiguration;
|
||||||
use ncc\Utilities\Functions;
|
use ncc\Utilities\Functions;
|
||||||
|
@ -173,9 +171,7 @@
|
||||||
* @param bool $throw_exception
|
* @param bool $throw_exception
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws BuildConfigurationNotFoundException
|
* @throws BuildConfigurationNotFoundException
|
||||||
* @throws InvalidBuildConfigurationException
|
* @throws ConfigurationException
|
||||||
* @throws InvalidConstantNameException
|
|
||||||
* @throws InvalidProjectBuildConfiguration
|
|
||||||
*/
|
*/
|
||||||
public function validate(bool $throw_exception=True): bool
|
public function validate(bool $throw_exception=True): bool
|
||||||
{
|
{
|
||||||
|
@ -184,7 +180,7 @@
|
||||||
{
|
{
|
||||||
if(!Validate::constantName($name))
|
if(!Validate::constantName($name))
|
||||||
{
|
{
|
||||||
throw new InvalidConstantNameException('The name \'' . $name . '\' is not valid for a constant declaration, ');
|
throw new ConfigurationException(sprintf('The name "%s" is not valid for a constant declaration', $name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,7 +192,7 @@
|
||||||
{
|
{
|
||||||
if($throw_exception)
|
if($throw_exception)
|
||||||
{
|
{
|
||||||
throw new InvalidProjectBuildConfiguration('The build configuration \'' . $configuration->name . '\' is already defined, build configuration names must be unique');
|
throw new ConfigurationException(sprintf('Invalid build configuration name "%s"', $configuration->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -205,16 +201,9 @@
|
||||||
|
|
||||||
foreach($this->build_configurations as $configuration)
|
foreach($this->build_configurations as $configuration)
|
||||||
{
|
{
|
||||||
try
|
if (!$configuration->validate($throw_exception))
|
||||||
{
|
{
|
||||||
if (!$configuration->validate($throw_exception))
|
return false;
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (InvalidBuildConfigurationException $e)
|
|
||||||
{
|
|
||||||
throw new InvalidBuildConfigurationException(sprintf('Error in build configuration \'%s\'', $configuration->name), $e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,7 +211,7 @@
|
||||||
{
|
{
|
||||||
if($throw_exception)
|
if($throw_exception)
|
||||||
{
|
{
|
||||||
throw new InvalidProjectBuildConfiguration('The default build configuration is not set');
|
throw new ConfigurationException('The default build configuration is not set');
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -232,7 +221,7 @@
|
||||||
{
|
{
|
||||||
if($throw_exception)
|
if($throw_exception)
|
||||||
{
|
{
|
||||||
throw new InvalidProjectBuildConfiguration('The default build configuration name \'' . $this->default_configuration . '\' is not valid');
|
throw new ConfigurationException(sprintf('The default build configuration name "%s" is not valid', $this->default_configuration));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -24,8 +24,7 @@
|
||||||
|
|
||||||
namespace ncc\Objects\ProjectConfiguration\Build;
|
namespace ncc\Objects\ProjectConfiguration\Build;
|
||||||
|
|
||||||
use ncc\Exceptions\InvalidBuildConfigurationException;
|
use ncc\Exceptions\ConfigurationException;
|
||||||
use ncc\Exceptions\InvalidDependencyConfiguration;
|
|
||||||
use ncc\Interfaces\BytecodeObjectInterface;
|
use ncc\Interfaces\BytecodeObjectInterface;
|
||||||
use ncc\Objects\ProjectConfiguration\Dependency;
|
use ncc\Objects\ProjectConfiguration\Dependency;
|
||||||
use ncc\Utilities\Functions;
|
use ncc\Utilities\Functions;
|
||||||
|
@ -113,7 +112,7 @@
|
||||||
*
|
*
|
||||||
* @param bool $throw_exception
|
* @param bool $throw_exception
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws InvalidBuildConfigurationException
|
* @throws ConfigurationException
|
||||||
*/
|
*/
|
||||||
public function validate(bool $throw_exception=True): bool
|
public function validate(bool $throw_exception=True): bool
|
||||||
{
|
{
|
||||||
|
@ -121,7 +120,7 @@
|
||||||
{
|
{
|
||||||
if($throw_exception)
|
if($throw_exception)
|
||||||
{
|
{
|
||||||
throw new InvalidBuildConfigurationException(sprintf('Invalid build configuration name "%s"', $this->name));
|
throw new ConfigurationException(sprintf('Invalid build configuration name "%s"', $this->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
return False;
|
return False;
|
||||||
|
@ -131,7 +130,7 @@
|
||||||
{
|
{
|
||||||
if($throw_exception)
|
if($throw_exception)
|
||||||
{
|
{
|
||||||
throw new InvalidBuildConfigurationException(sprintf('\'output_path\' contains an invalid path name in %s', $this->name));
|
throw new ConfigurationException(sprintf('Invalid build configuration name "%s"', $this->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
return False;
|
return False;
|
||||||
|
@ -141,7 +140,7 @@
|
||||||
{
|
{
|
||||||
if($throw_exception)
|
if($throw_exception)
|
||||||
{
|
{
|
||||||
throw new InvalidBuildConfigurationException(sprintf('\'define_constants\' must be an array in %s', $this->name));
|
throw new ConfigurationException(sprintf('Invalid build configuration name "%s"', $this->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
return False;
|
return False;
|
||||||
|
@ -151,7 +150,7 @@
|
||||||
{
|
{
|
||||||
if($throw_exception)
|
if($throw_exception)
|
||||||
{
|
{
|
||||||
throw new InvalidBuildConfigurationException(sprintf('\'exclude_files\' must be an array in %s', $this->name));
|
throw new ConfigurationException(sprintf('Invalid build configuration name "%s"', $this->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
return False;
|
return False;
|
||||||
|
@ -161,7 +160,7 @@
|
||||||
{
|
{
|
||||||
if($throw_exception)
|
if($throw_exception)
|
||||||
{
|
{
|
||||||
throw new InvalidBuildConfigurationException(sprintf('\'pre_build\' must be an array in %s', $this->name));
|
throw new ConfigurationException(sprintf('Invalid build configuration name "%s"', $this->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
return False;
|
return False;
|
||||||
|
@ -171,7 +170,7 @@
|
||||||
{
|
{
|
||||||
if($throw_exception)
|
if($throw_exception)
|
||||||
{
|
{
|
||||||
throw new InvalidBuildConfigurationException(sprintf('\'post_build\' must be an array in %s', $this->name));
|
throw new ConfigurationException(sprintf('Invalid build configuration name "%s"', $this->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
return False;
|
return False;
|
||||||
|
@ -181,7 +180,7 @@
|
||||||
{
|
{
|
||||||
if($throw_exception)
|
if($throw_exception)
|
||||||
{
|
{
|
||||||
throw new InvalidBuildConfigurationException(sprintf('\'dependencies\' must be an array in %s', $this->name));
|
throw new ConfigurationException(sprintf('Invalid build configuration name "%s"', $this->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
return False;
|
return False;
|
||||||
|
@ -197,11 +196,11 @@
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (InvalidDependencyConfiguration $e)
|
catch (ConfigurationException $e)
|
||||||
{
|
{
|
||||||
if($throw_exception)
|
if($throw_exception)
|
||||||
{
|
{
|
||||||
throw new InvalidBuildConfigurationException(sprintf('Invalid dependency configuration in %s: %s', $this->name, $e->getMessage()));
|
throw $e;
|
||||||
}
|
}
|
||||||
|
|
||||||
return False;
|
return False;
|
||||||
|
|
|
@ -27,10 +27,9 @@
|
||||||
use Exception;
|
use Exception;
|
||||||
use ncc\Enums\CompilerExtensions;
|
use ncc\Enums\CompilerExtensions;
|
||||||
use ncc\Enums\CompilerExtensionSupportedVersions;
|
use ncc\Enums\CompilerExtensionSupportedVersions;
|
||||||
|
use ncc\Exceptions\ConfigurationException;
|
||||||
use ncc\Exceptions\InvalidPropertyValueException;
|
use ncc\Exceptions\InvalidPropertyValueException;
|
||||||
use ncc\Exceptions\InvalidVersionConfigurationException;
|
|
||||||
use ncc\Exceptions\NotSupportedException;
|
use ncc\Exceptions\NotSupportedException;
|
||||||
use ncc\Exceptions\RuntimeException;
|
|
||||||
use ncc\Interfaces\BytecodeObjectInterface;
|
use ncc\Interfaces\BytecodeObjectInterface;
|
||||||
use ncc\ThirdParty\jelix\Version\VersionComparator;
|
use ncc\ThirdParty\jelix\Version\VersionComparator;
|
||||||
use ncc\Utilities\Functions;
|
use ncc\Utilities\Functions;
|
||||||
|
@ -67,9 +66,9 @@
|
||||||
*
|
*
|
||||||
* @param bool $throw_exception
|
* @param bool $throw_exception
|
||||||
* @return bool
|
* @return bool
|
||||||
|
* @throws ConfigurationException
|
||||||
* @throws InvalidPropertyValueException
|
* @throws InvalidPropertyValueException
|
||||||
* @throws NotSupportedException
|
* @throws NotSupportedException
|
||||||
* @throws RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function validate(bool $throw_exception=True): bool
|
public function validate(bool $throw_exception=True): bool
|
||||||
{
|
{
|
||||||
|
@ -109,7 +108,7 @@
|
||||||
{
|
{
|
||||||
if($throw_exception)
|
if($throw_exception)
|
||||||
{
|
{
|
||||||
throw new InvalidVersionConfigurationException('The minimum version cannot be greater version number than the maximum version');
|
throw new ConfigurationException('The minimum version cannot be greater version number than the maximum version');
|
||||||
}
|
}
|
||||||
|
|
||||||
return False;
|
return False;
|
||||||
|
@ -117,7 +116,7 @@
|
||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (Exception $e)
|
||||||
{
|
{
|
||||||
throw new RuntimeException('Version comparison failed: ' . $e->getMessage());
|
throw new ConfigurationException('Version comparison failed: ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!in_array($this->extension, CompilerExtensions::ALL))
|
if(!in_array($this->extension, CompilerExtensions::ALL))
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
namespace ncc\Objects\ProjectConfiguration;
|
namespace ncc\Objects\ProjectConfiguration;
|
||||||
|
|
||||||
use ncc\Exceptions\InvalidDependencyConfiguration;
|
use ncc\Exceptions\ConfigurationException;
|
||||||
use ncc\Interfaces\BytecodeObjectInterface;
|
use ncc\Interfaces\BytecodeObjectInterface;
|
||||||
use ncc\Utilities\Functions;
|
use ncc\Utilities\Functions;
|
||||||
use ncc\Utilities\Validate;
|
use ncc\Utilities\Validate;
|
||||||
|
@ -68,7 +68,7 @@
|
||||||
*
|
*
|
||||||
* @param bool $throw_exception
|
* @param bool $throw_exception
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws InvalidDependencyConfiguration
|
* @throws ConfigurationException
|
||||||
*/
|
*/
|
||||||
public function validate(bool $throw_exception): bool
|
public function validate(bool $throw_exception): bool
|
||||||
{
|
{
|
||||||
|
@ -76,7 +76,7 @@
|
||||||
{
|
{
|
||||||
if($throw_exception)
|
if($throw_exception)
|
||||||
{
|
{
|
||||||
throw new InvalidDependencyConfiguration(sprintf('Invalid dependency name "%s"', $this->name));
|
throw new ConfigurationException(sprintf('Invalid dependency name "%s"', $this->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -86,7 +86,7 @@
|
||||||
{
|
{
|
||||||
if($throw_exception)
|
if($throw_exception)
|
||||||
{
|
{
|
||||||
throw new InvalidDependencyConfiguration(sprintf('Invalid dependency version "%s"', $this->version));
|
throw new ConfigurationException(sprintf('Invalid dependency version "%s"', $this->version));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -174,8 +174,6 @@
|
||||||
*
|
*
|
||||||
* @param string $package
|
* @param string $package
|
||||||
* @return string
|
* @return string
|
||||||
* @throws Exceptions\InvalidPackageNameException
|
|
||||||
* @throws Exceptions\InvalidScopeException
|
|
||||||
* @throws PackageLockException
|
* @throws PackageLockException
|
||||||
* @throws PackageNotFoundException
|
* @throws PackageNotFoundException
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,31 +1,30 @@
|
||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Nosial 2022-2023, all rights reserved.
|
* 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
|
* 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
|
* 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
|
* 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
|
* Software, and to permit persons to whom the Software is furnished to do so, subject to the following
|
||||||
* conditions:
|
* conditions:
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions
|
* The above copyright notice and this permission notice shall be included in all copies or substantial portions
|
||||||
* of the Software.
|
* of the Software.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
* 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
|
* 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
|
* 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
|
* 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
|
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace ncc\Utilities;
|
namespace ncc\Utilities;
|
||||||
|
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
use ncc\Enums\Scopes;
|
use ncc\Enums\Scopes;
|
||||||
use ncc\Exceptions\InvalidPackageNameException;
|
use ncc\Exceptions\ConfigurationException;
|
||||||
use ncc\Exceptions\InvalidScopeException;
|
|
||||||
use ncc\Exceptions\RunnerExecutionException;
|
use ncc\Exceptions\RunnerExecutionException;
|
||||||
use ncc\ThirdParty\Symfony\Process\ExecutableFinder;
|
use ncc\ThirdParty\Symfony\Process\ExecutableFinder;
|
||||||
|
|
||||||
|
@ -46,7 +45,6 @@ namespace ncc\Utilities;
|
||||||
*
|
*
|
||||||
* @param string $scope
|
* @param string $scope
|
||||||
* @return string
|
* @return string
|
||||||
* @throws InvalidScopeException
|
|
||||||
*/
|
*/
|
||||||
public static function getHomePath(string $scope=Scopes::AUTO): string
|
public static function getHomePath(string $scope=Scopes::AUTO): string
|
||||||
{
|
{
|
||||||
|
@ -54,7 +52,7 @@ namespace ncc\Utilities;
|
||||||
|
|
||||||
if(!Validate::scope($scope, false))
|
if(!Validate::scope($scope, false))
|
||||||
{
|
{
|
||||||
throw new InvalidScopeException($scope);
|
throw new InvalidArgumentException(sprintf('Invalid access scope "%s"', $scope));
|
||||||
}
|
}
|
||||||
|
|
||||||
switch($scope)
|
switch($scope)
|
||||||
|
@ -67,7 +65,7 @@ namespace ncc\Utilities;
|
||||||
return posix_getpwuid(0)['dir'] . DIRECTORY_SEPARATOR . '.ncc';
|
return posix_getpwuid(0)['dir'] . DIRECTORY_SEPARATOR . '.ncc';
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new InvalidScopeException($scope);
|
throw new InvalidArgumentException(sprintf('Invalid access scope "%s"', $scope));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -183,13 +181,13 @@ namespace ncc\Utilities;
|
||||||
*
|
*
|
||||||
* @param string $package
|
* @param string $package
|
||||||
* @return string
|
* @return string
|
||||||
* @throws InvalidPackageNameException
|
* @throws ConfigurationException
|
||||||
*/
|
*/
|
||||||
public static function getPackageDataPath(string $package): string
|
public static function getPackageDataPath(string $package): string
|
||||||
{
|
{
|
||||||
if(!Validate::packageName($package))
|
if(!Validate::packageName($package))
|
||||||
{
|
{
|
||||||
throw new InvalidPackageNameException($package);
|
throw new ConfigurationException($package);
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::getDataPath(Scopes::SYSTEM) . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . $package;
|
return self::getDataPath(Scopes::SYSTEM) . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . $package;
|
||||||
|
|
Loading…
Add table
Reference in a new issue