- Removed unused exception InvalidBuildConfigurationException in \ncc\Exceptions (not used)

- Removed unused exception `InvalidPropertyValue` in `\ncc\Exceptions` in favor of `ConfigurationException`
 - Removed unused exception `InvalidVersionConfiguration` in `\ncc\Exceptions` (not used)
 - Removed unused exception `InvalidDependencyConfiguraiton` in `\ncc\Exceptions` (not used)
 - Removed unused exception `ProjectConfigurationNotFoundException` in `\ncc\Exceptions` in favor of `ConfigurationException`
 - Removed unused exception `UndefinedExecutionPolicyExpection` in `\ncc\Exceptions` in favor of `ConfigurationException`
 - Removed unused exception `InvalidExecutionPolicyName` in `\ncc\Exceptions` (not used)
This commit is contained in:
Netkas 2023-08-21 20:30:48 -04:00
parent 59dc4bb9cb
commit b685d66b77
No known key found for this signature in database
GPG key ID: 5DAF58535614062B
20 changed files with 103 additions and 477 deletions

View file

@ -140,6 +140,13 @@ features.
- 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`
- Removed unused exception `InvalidBuildConfigurationException` in `\ncc\Exceptions` (not used)
- Removed unused exception `InvalidPropertyValue` in `\ncc\Exceptions` in favor of `ConfigurationException`
- Removed unused exception `InvalidVersionConfiguration` in `\ncc\Exceptions` (not used)
- Removed unused exception `InvalidDependencyConfiguraiton` in `\ncc\Exceptions` (not used)
- Removed unused exception `ProjectConfigurationNotFoundException` in `\ncc\Exceptions` in favor of `ConfigurationException`
- Removed unused exception `UndefinedExecutionPolicyExpection` in `\ncc\Exceptions` in favor of `ConfigurationException`
- Removed unused exception `InvalidExecutionPolicyName` in `\ncc\Exceptions` (not used)

View file

@ -6,15 +6,15 @@ ConfigurationException
* INVALID_PACKAGE_NAME
* INVALID_VERSION_NUMBER
* INVALID_PROJECT_NAME
BUILD_CONFIGURATION_NOT_FOUND
INVALID_PROJECT_BUILD_CONFIGURATION
INVALID_PROPERTY_VALUE
INVALID_VERSION_CONFIGURATION
INVALID_BUILD_CONFIGURATION
INVALID_DEPENDENCY_CONFIGURATION
PROJECT_CONFIGURATION_NOT_FOUND
UNDEFINED_EXECUTION_POLICY
INVALID_EXECUTION_POLICY_NAME
* BUILD_CONFIGURATION_NOT_FOUND
* INVALID_PROJECT_BUILD_CONFIGURATION
* INVALID_PROPERTY_VALUE
* INVALID_VERSION_CONFIGURATION
* INVALID_BUILD_CONFIGURATION
* INVALID_DEPENDENCY_CONFIGURATION
* PROJECT_CONFIGURATION_NOT_FOUND
* UNDEFINED_EXECUTION_POLICY
* INVALID_EXECUTION_POLICY_NAME
AuthenticationException
ACCESS_DENIED
@ -80,7 +80,7 @@ IntegrityException
CONSTANT_READ_ONLY
INVALID_CONSTANT_NAME
COMPONENT_DECODE_EXCEPTION
* RESOURCE_CHECKSUM_EXCEPTION
RESOURCE_CHECKSUM_EXCEPTION
AutoLoadException
AUTOLOAD_GENERATOR

View file

@ -31,7 +31,6 @@
use ncc\Exceptions\MalformedJsonException;
use ncc\Exceptions\PathNotFoundException;
use ncc\Exceptions\ProjectAlreadyExistsException;
use ncc\Exceptions\ProjectConfigurationNotFoundException;
use ncc\Managers\ProjectManager;
use ncc\Objects\CliHelpSection;
use ncc\Objects\ProjectConfiguration\Compiler;
@ -45,10 +44,10 @@
*
* @param $args
* @return void
* @throws ConfigurationException
* @throws IOException
* @throws MalformedJsonException
* @throws PathNotFoundException
* @throws ProjectConfigurationNotFoundException
*/
public static function start($args): void
{
@ -65,10 +64,10 @@
*
* @param $args
* @return void
* @throws ConfigurationException
* @throws IOException
* @throws MalformedJsonException
* @throws PathNotFoundException
* @throws ProjectConfigurationNotFoundException
*/
public static function createProject($args): void
{

View file

@ -1,26 +1,26 @@
<?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.
*
*/
/*
* 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\Classes\ComposerExtension;
namespace ncc\Classes\ComposerExtension;
use Exception;
use FilesystemIterator;
@ -33,18 +33,18 @@ namespace ncc\Classes\ComposerExtension;
use ncc\Enums\Scopes;
use ncc\CLI\Main;
use ncc\Exceptions\AccessDeniedException;
use ncc\Exceptions\BuildConfigurationNotFoundException;
use ncc\Exceptions\BuildException;
use ncc\Exceptions\ComposerDisabledException;
use ncc\Exceptions\ComposerException;
use ncc\Exceptions\ComposerNotAvailableException;
use ncc\Exceptions\ConfigurationException;
use ncc\Exceptions\NotSupportedException;
use ncc\Exceptions\PathNotFoundException;
use ncc\Exceptions\InternalComposerNotAvailableException;
use ncc\Exceptions\IOException;
use ncc\Exceptions\MalformedJsonException;
use ncc\Exceptions\PackageNotFoundException;
use ncc\Exceptions\PackagePreparationFailedException;
use ncc\Exceptions\ProjectConfigurationNotFoundException;
use ncc\Exceptions\RuntimeException;
use ncc\Exceptions\UserAbortedOperationException;
use ncc\Interfaces\ServiceSourceInterface;
@ -80,18 +80,18 @@ namespace ncc\Classes\ComposerExtension;
* @param RemotePackageInput $packageInput
* @return string
* @throws AccessDeniedException
* @throws BuildConfigurationNotFoundException
* @throws BuildException
* @throws ComposerDisabledException
* @throws ComposerException
* @throws ComposerNotAvailableException
* @throws ConfigurationException
* @throws IOException
* @throws InternalComposerNotAvailableException
* @throws MalformedJsonException
* @throws NotSupportedException
* @throws PackageNotFoundException
* @throws PackagePreparationFailedException
* @throws PathNotFoundException
* @throws ProjectConfigurationNotFoundException
* @throws RuntimeException
* @throws UserAbortedOperationException
*/
@ -120,18 +120,18 @@ namespace ncc\Classes\ComposerExtension;
* @param string $path
* @return string
* @throws AccessDeniedException
* @throws BuildConfigurationNotFoundException
* @throws BuildException
* @throws ComposerDisabledException
* @throws ComposerException
* @throws ComposerNotAvailableException
* @throws ConfigurationException
* @throws IOException
* @throws InternalComposerNotAvailableException
* @throws MalformedJsonException
* @throws NotSupportedException
* @throws PackageNotFoundException
* @throws PackagePreparationFailedException
* @throws PathNotFoundException
* @throws ProjectConfigurationNotFoundException
* @throws UserAbortedOperationException
*/
public static function fromLocal(string $path): string
@ -195,14 +195,14 @@ namespace ncc\Classes\ComposerExtension;
* @param string $composer_lock_path
* @return array
* @throws AccessDeniedException
* @throws BuildConfigurationNotFoundException
* @throws BuildException
* @throws IOException
* @throws MalformedJsonException
* @throws PackageNotFoundException
* @throws PackagePreparationFailedException
* @throws PathNotFoundException
* @throws ProjectConfigurationNotFoundException
* @throws ConfigurationException
* @throws NotSupportedException
*/
private static function compilePackages(string $composer_lock_path): array
{
@ -822,7 +822,7 @@ namespace ncc\Classes\ComposerExtension;
}
}
if(Functions::cbool(Functions::getConfigurationProperty('composer.extension.display_authors')) && !is_null($composer_package->Authors) && count($composer_package->Authors) > 0)
if(Functions::cbool(!is_null($composer_package->Authors) && count($composer_package->Authors) > 0 && Functions::getConfigurationProperty('composer.extension.display_authors')))
{
Console::out(sprintf('Authors for package %s:', $composer_package->Name));
foreach($composer_package->Authors as $author)

View file

@ -32,13 +32,12 @@
use ncc\Classes\PhpExtension\PhpCompiler;
use ncc\CLI\Main;
use ncc\Exceptions\AccessDeniedException;
use ncc\Exceptions\BuildConfigurationNotFoundException;
use ncc\Exceptions\BuildException;
use ncc\Exceptions\ConfigurationException;
use ncc\Exceptions\IOException;
use ncc\Exceptions\MalformedJsonException;
use ncc\Exceptions\NotSupportedException;
use ncc\Exceptions\PathNotFoundException;
use ncc\Exceptions\ProjectConfigurationNotFoundException;
use ncc\Exceptions\RunnerExecutionException;
use ncc\Interfaces\CompilerInterface;
use ncc\Managers\ProjectManager;
@ -60,13 +59,12 @@
* @param string $build_configuration
* @return string
* @throws AccessDeniedException
* @throws BuildConfigurationNotFoundException
* @throws BuildException
* @throws ConfigurationException
* @throws IOException
* @throws MalformedJsonException
* @throws NotSupportedException
* @throws PathNotFoundException
* @throws ProjectConfigurationNotFoundException
*/
public static function compile(ProjectManager $manager, string $build_configuration=BuildConfigurationValues::DEFAULT): string
{
@ -205,8 +203,8 @@
* @param ProjectConfiguration $configuration
* @param string $build_configuration
* @return string
* @throws BuildConfigurationNotFoundException
* @throws IOException
* @throws ConfigurationException
*/
public static function writePackage(string $path, Package $package, ProjectConfiguration $configuration, string $build_configuration=BuildConfigurationValues::DEFAULT): string
{

View file

@ -1,24 +1,24 @@
<?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.
*
*/
/*
* 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.
*
*/
/** @noinspection PhpMissingFieldTypeInspection */
@ -33,8 +33,8 @@
use ncc\Enums\Options\BuildConfigurationValues;
use ncc\Classes\NccExtension\PackageCompiler;
use ncc\Exceptions\AccessDeniedException;
use ncc\Exceptions\BuildConfigurationNotFoundException;
use ncc\Exceptions\BuildException;
use ncc\Exceptions\ConfigurationException;
use ncc\Exceptions\IOException;
use ncc\Exceptions\PackageLockException;
use ncc\Exceptions\PackagePreparationFailedException;
@ -88,7 +88,7 @@
* @param string $build_configuration
* @return void
* @throws PackagePreparationFailedException
* @throws BuildConfigurationNotFoundException
* @throws ConfigurationException
*/
public function prepare(string $build_configuration=BuildConfigurationValues::DEFAULT): void
{
@ -355,7 +355,6 @@
* Compiles the resources of the package
*
* @return void
* @throws AccessDeniedException
* @throws BuildException
* @throws IOException
* @throws PathNotFoundException
@ -408,7 +407,6 @@
* Compiles the components of the package
*
* @return void
* @throws AccessDeniedException
* @throws BuildException
* @throws IOException
* @throws PathNotFoundException

View file

@ -48,11 +48,6 @@
*/
public const CONSTANT_READ_ONLY = -1709;
/**
* @see InvalidVersionNumberException
*/
public const INVALID_VERSION_NUMBER = -1711;
/**
* @see ProjectAlreadyExistsException
*/
@ -78,21 +73,6 @@
*/
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 InvalidPropertyValueException
*/
public const INVALID_PROPERTY_VALUE = -1724;
/**
* @see BuildException
*/
@ -128,21 +108,6 @@
*/
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
*/
@ -223,11 +188,6 @@
*/
public const PACKAGE_FETCH_EXCEPTION = -1765;
/**
* @see InvalidDependencyConfiguration
*/
public const INVALID_DEPENDENCY_CONFIGURATION = -1767;
/**
* @see SymlinkException
*/
@ -256,15 +216,11 @@
self::MALFORMED_JSON,
self::RUNTIME,
self::CONSTANT_READ_ONLY,
self::INVALID_VERSION_NUMBER,
self::PROJECT_ALREADY_EXISTS,
self::AUTOLOAD_GENERATOR,
self::NO_UNITS_FOUND,
self::INVALID_CONSTANT_NAME,
self::PACKAGE_PREPARATION_FAILED,
self::BUILD_CONFIGURATION_NOT_FOUND,
self::INVALID_PROJECT_BUILD_CONFIGURATION,
self::INVALID_PROPERTY_VALUE,
self::BUILD_EXCEPTION,
self::PACKAGE_PARSING_EXCEPTION,
self::PACKAGE_LOCK_EXCEPTION,
@ -272,9 +228,6 @@
self::COMPONENT_DECODE_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,
@ -290,7 +243,6 @@
self::NOT_SUPPORTED_EXCEPTION,
self::ARCHIVE_EXCEPTION,
self::PACKAGE_FETCH_EXCEPTION,
self::INVALID_DEPENDENCY_CONFIGURATION,
self::SYMLINK_EXCEPTION,
self::PATH_NOT_FOUND,
self::GIT_EXCEPTION,

View file

@ -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 BuildConfigurationNotFoundException extends Exception
{
/**
* @param string $message
* @param Throwable|null $previous
*/
public function __construct(string $message = "", ?Throwable $previous = null)
{
parent::__construct($message, ExceptionCodes::BUILD_CONFIGURATION_NOT_FOUND, $previous);
}
}

View file

@ -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 InvalidDependencyConfiguration extends Exception
{
/**
* @param string $message
* @param Throwable|null $previous
*/
public function __construct(string $message = "", ?Throwable $previous = null)
{
parent::__construct($message, ExceptionCodes::INVALID_DEPENDENCY_CONFIGURATION, $previous);
}
}

View file

@ -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 InvalidExecutionPolicyName extends Exception
{
/**
* @param string $message
* @param Throwable|null $previous
*/
public function __construct(string $message = "", ?Throwable $previous = null)
{
parent::__construct($message, ExceptionCodes::INVALID_EXECUTION_POLICY_NAME, $previous);
}
}

View file

@ -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 InvalidProjectBuildConfiguration extends Exception
{
/**
* @param string $message
* @param Throwable|null $previous
*/
public function __construct(string $message = "", ?Throwable $previous = null)
{
parent::__construct($message, ExceptionCodes::INVALID_PROJECT_BUILD_CONFIGURATION, $previous);
}
}

View file

@ -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 InvalidPropertyValueException extends Exception
{
/**
* @param string $message
* @param Throwable|null $previous
*/
public function __construct(string $message = "", ?Throwable $previous = null)
{
parent::__construct($message, ExceptionCodes::INVALID_PROPERTY_VALUE, $previous);
}
}

View file

@ -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 InvalidVersionNumberException extends Exception
{
/**
* @param string $message
* @param Throwable|null $previous
*/
public function __construct(string $message = "", ?Throwable $previous = null)
{
parent::__construct($message, ExceptionCodes::INVALID_VERSION_NUMBER, $previous);
}
}

View file

@ -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 ProjectConfigurationNotFoundException extends Exception
{
/**
* @param string $message
* @param Throwable|null $previous
*/
public function __construct(string $message = "", ?Throwable $previous = null)
{
parent::__construct($message, ExceptionCodes::PROJECT_CONFIGURATION_NOT_FOUND, $previous);
}
}

View file

@ -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 UndefinedExecutionPolicyException extends Exception
{
/**
* @param string $message
* @param Throwable|null $previous
*/
public function __construct(string $message = "", ?Throwable $previous = null)
{
parent::__construct($message, ExceptionCodes::UNDEFINED_EXECUTION_POLICY, $previous);
}
}

View file

@ -29,7 +29,6 @@
use ncc\Enums\Options\InitializeProjectOptions;
use ncc\Classes\NccExtension\PackageCompiler;
use ncc\Exceptions\AccessDeniedException;
use ncc\Exceptions\BuildConfigurationNotFoundException;
use ncc\Exceptions\BuildException;
use ncc\Exceptions\ConfigurationException;
use ncc\Exceptions\IOException;
@ -37,7 +36,6 @@
use ncc\Exceptions\NotSupportedException;
use ncc\Exceptions\PathNotFoundException;
use ncc\Exceptions\ProjectAlreadyExistsException;
use ncc\Exceptions\ProjectConfigurationNotFoundException;
use ncc\Objects\ProjectConfiguration;
use ncc\Objects\ProjectConfiguration\Compiler;
use ncc\ThirdParty\Symfony\Uid\Uuid;
@ -71,10 +69,10 @@
* Public Constructor
*
* @param string $path
* @throws ConfigurationException
* @throws IOException
* @throws MalformedJsonException
* @throws PathNotFoundException
* @throws ProjectConfigurationNotFoundException
*/
public function __construct(string $path)
{
@ -215,16 +213,16 @@
* Attempts to load the project configuration
*
* @return void
* @throws ConfigurationException
* @throws IOException
* @throws MalformedJsonException
* @throws PathNotFoundException
* @throws ProjectConfigurationNotFoundException
*/
public function load(): void
{
if(!file_exists($this->project_file_path) && !is_file($this->project_file_path))
{
throw new ProjectConfigurationNotFoundException('The project configuration file \'' . $this->project_file_path . '\' was not found');
throw new ConfigurationException('The project configuration file \'' . $this->project_file_path . '\' was not found');
}
$this->project_configuration = ProjectConfiguration::fromFile($this->project_file_path);
@ -250,10 +248,10 @@
* Returns the ProjectConfiguration object
*
* @return ProjectConfiguration
* @throws ConfigurationException
* @throws IOException
* @throws MalformedJsonException
* @throws PathNotFoundException
* @throws ProjectConfigurationNotFoundException
*/
public function getProjectConfiguration(): ProjectConfiguration
{
@ -282,13 +280,12 @@
* @param string $build_configuration
* @return string
* @throws AccessDeniedException
* @throws BuildConfigurationNotFoundException
* @throws BuildException
* @throws ConfigurationException
* @throws IOException
* @throws MalformedJsonException
* @throws PathNotFoundException
* @throws ProjectConfigurationNotFoundException
* @throws NotSupportedException
* @throws PathNotFoundException
*/
public function build(string $build_configuration=BuildConfigurationValues::DEFAULT): string
{

View file

@ -26,16 +26,11 @@
use Exception;
use ncc\Enums\Options\BuildConfigurationValues;
use ncc\Exceptions\BuildConfigurationNotFoundException;
use ncc\Exceptions\ConfigurationException;
use ncc\Exceptions\InvalidConstantNameException;
use ncc\Exceptions\InvalidProjectBuildConfiguration;
use ncc\Exceptions\InvalidPropertyValueException;
use ncc\Exceptions\IOException;
use ncc\Exceptions\MalformedJsonException;
use ncc\Exceptions\NotSupportedException;
use ncc\Exceptions\PathNotFoundException;
use ncc\Exceptions\RuntimeException;
use ncc\Exceptions\UndefinedExecutionPolicyException;
use ncc\Interfaces\BytecodeObjectInterface;
use ncc\Objects\ProjectConfiguration\Assembly;
use ncc\Objects\ProjectConfiguration\Build;
@ -102,11 +97,8 @@
*
* @param bool $throw_exception
* @return bool
* @throws BuildConfigurationNotFoundException
* @throws ConfigurationException
* @throws InvalidPropertyValueException
* @throws RuntimeException
* @throws UndefinedExecutionPolicyException
* @throws NotSupportedException
*/
public function validate(bool $throw_exception=True): bool
{
@ -146,7 +138,7 @@
{
if($throw_exception)
{
throw new UndefinedExecutionPolicyException(sprintf('Build configuration build.main uses an execution policy "%s" but no policies are defined', $this->build->main));
throw new ConfigurationException(sprintf('Build configuration build.main uses an execution policy "%s" but no policies are defined', $this->build->main));
}
return false;
@ -167,7 +159,7 @@
{
if($throw_exception)
{
throw new UndefinedExecutionPolicyException(sprintf('Build configuration build.main points to a undefined execution policy "%s"', $this->build->main));
throw new ConfigurationException(sprintf('Build configuration build.main points to a undefined execution policy "%s"', $this->build->main));
}
return false;
}
@ -208,8 +200,7 @@
*
* @param string $build_configuration
* @return array
* @throws BuildConfigurationNotFoundException
* @throws UndefinedExecutionPolicyException
* @throws ConfigurationException
*/
public function getRequiredExecutionPolicies(string $build_configuration=BuildConfigurationValues::DEFAULT): array
{
@ -244,7 +235,7 @@
{
if(!in_array($unit, $defined_polices, true))
{
throw new UndefinedExecutionPolicyException('The property \'' . $key . '\' in the project configuration calls for an undefined execution policy \'' . $unit . '\'');
throw new ConfigurationException('The property \'' . $key . '\' in the project configuration calls for an undefined execution policy \'' . $unit . '\'');
}
if(!in_array($unit, $required_policies, true))
@ -261,7 +252,7 @@
{
if(!in_array($unit, $defined_polices, true))
{
throw new UndefinedExecutionPolicyException('The property \'build.pre_build\' in the project configuration calls for an undefined execution policy \'' . $unit . '\'');
throw new ConfigurationException('The property \'build.pre_build\' in the project configuration calls for an undefined execution policy \'' . $unit . '\'');
}
if(!in_array($unit, $required_policies, true))
@ -277,7 +268,7 @@
{
if(!in_array($unit, $defined_polices, true))
{
throw new UndefinedExecutionPolicyException('The property \'build.pre_build\' in the project configuration calls for an undefined execution policy \'' . $unit . '\'');
throw new ConfigurationException('The property \'build.pre_build\' in the project configuration calls for an undefined execution policy \'' . $unit . '\'');
}
if(!in_array($unit, $required_policies, true))
@ -328,7 +319,7 @@
{
if(!in_array($execution_policy?->exit_handlers->success->run, $defined_polices, true))
{
throw new UndefinedExecutionPolicyException('The execution policy \'' . $execution_policy?->name . '\' Success exit handler points to a undefined execution policy \'' . $execution_policy?->exit_handlers->success->run . '\'');
throw new ConfigurationException('The execution policy \'' . $execution_policy?->name . '\' Success exit handler points to a undefined execution policy \'' . $execution_policy?->exit_handlers->success->run . '\'');
}
if(!in_array($execution_policy?->exit_handlers->success->run, $required_policies, true))
@ -341,7 +332,7 @@
{
if(!in_array($execution_policy?->exit_handlers->warning->run, $defined_polices, true))
{
throw new UndefinedExecutionPolicyException('The execution policy \'' . $execution_policy?->name . '\' Warning exit handler points to a undefined execution policy \'' . $execution_policy?->exit_handlers->warning->run . '\'');
throw new ConfigurationException('The execution policy \'' . $execution_policy?->name . '\' Warning exit handler points to a undefined execution policy \'' . $execution_policy?->exit_handlers->warning->run . '\'');
}
if(!in_array($execution_policy?->exit_handlers->warning->run, $required_policies, true))
@ -354,7 +345,7 @@
{
if(!in_array($execution_policy?->exit_handlers->error->run, $defined_polices, true))
{
throw new UndefinedExecutionPolicyException('The execution policy \'' . $execution_policy?->name . '\' Error exit handler points to a undefined execution policy \'' . $execution_policy?->exit_handlers->error->run . '\'');
throw new ConfigurationException('The execution policy \'' . $execution_policy?->name . '\' Error exit handler points to a undefined execution policy \'' . $execution_policy?->exit_handlers->error->run . '\'');
}
if(!in_array($execution_policy?->exit_handlers->error->run, $required_policies, true))
@ -407,7 +398,7 @@
* @param BuildConfiguration $configuration
* @param array $defined_polices
* @return array
* @throws UndefinedExecutionPolicyException
* @throws ConfigurationException
*/
private function processBuildPolicies(BuildConfiguration $configuration, array $defined_polices): array
{
@ -419,7 +410,7 @@
{
if (!in_array($unit, $defined_polices, true))
{
throw new UndefinedExecutionPolicyException('The property \'pre_build\' in the build configuration \'' . $configuration->name . '\' calls for an undefined execution policy \'' . $unit . '\'');
throw new ConfigurationException(sprintf("The property 'pre_build' in the build configuration '%s' calls for an undefined execution policy '%s'", $configuration->name, $unit));
}
$required_policies[] = $unit;
@ -432,7 +423,7 @@
{
if (!in_array($unit, $defined_polices, true))
{
throw new UndefinedExecutionPolicyException('The property \'pre_build\' in the build configuration \'' . $configuration->name . '\' calls for an undefined execution policy \'' . $unit . '\'');
throw new ConfigurationException(sprintf("The property 'post_build' in the build configuration '%s' calls for an undefined execution policy '%s'", $configuration->name, $unit));
}
$required_policies[] = $unit;

View file

@ -25,7 +25,6 @@
namespace ncc\Objects\ProjectConfiguration;
use ncc\Enums\Options\BuildConfigurationValues;
use ncc\Exceptions\BuildConfigurationNotFoundException;
use ncc\Exceptions\ConfigurationException;
use ncc\Interfaces\BytecodeObjectInterface;
use ncc\Objects\ProjectConfiguration\Build\BuildConfiguration;
@ -170,7 +169,6 @@
*
* @param bool $throw_exception
* @return bool
* @throws BuildConfigurationNotFoundException
* @throws ConfigurationException
*/
public function validate(bool $throw_exception=True): bool
@ -256,7 +254,7 @@
*
* @param string $name
* @return BuildConfiguration
* @throws BuildConfigurationNotFoundException
* @throws ConfigurationException
*/
public function getBuildConfiguration(string $name): BuildConfiguration
{
@ -273,7 +271,7 @@
}
}
throw new BuildConfigurationNotFoundException('The build configuration ' . $name . ' does not exist');
throw new ConfigurationException(sprintf('The build configuration "%s" does not exist', $name));
}
/**

View file

@ -28,7 +28,6 @@
use ncc\Enums\CompilerExtensions;
use ncc\Enums\CompilerExtensionSupportedVersions;
use ncc\Exceptions\ConfigurationException;
use ncc\Exceptions\InvalidPropertyValueException;
use ncc\Exceptions\NotSupportedException;
use ncc\Interfaces\BytecodeObjectInterface;
use ncc\ThirdParty\jelix\Version\VersionComparator;
@ -67,7 +66,6 @@
* @param bool $throw_exception
* @return bool
* @throws ConfigurationException
* @throws InvalidPropertyValueException
* @throws NotSupportedException
*/
public function validate(bool $throw_exception=True): bool
@ -76,7 +74,7 @@
{
if($throw_exception)
{
throw new InvalidPropertyValueException('The property \'extension\' must not be null.');
throw new ConfigurationException('The property \'extension\' must not be null.');
}
return False;
@ -86,7 +84,7 @@
{
if($throw_exception)
{
throw new InvalidPropertyValueException('The property \'minimum_version\' must not be null.');
throw new ConfigurationException('The property \'minimum_version\' must not be null.');
}
return False;
@ -96,7 +94,7 @@
{
if($throw_exception)
{
throw new InvalidPropertyValueException('The property \'maximum_version\' must not be null.');
throw new ConfigurationException('The property \'maximum_version\' must not be null.');
}
return False;

View file

@ -24,8 +24,8 @@
namespace ncc\Objects\ProjectConfiguration;
use ncc\Exceptions\InvalidPropertyValueException;
use ncc\Exceptions\RuntimeException;
use ncc\Exceptions\ConfigurationException;
use ncc\Exceptions\NotSupportedException;
use ncc\Interfaces\BytecodeObjectInterface;
use ncc\Utilities\Functions;
@ -64,8 +64,8 @@
*
* @param bool $throw_exception
* @return bool
* @throws InvalidPropertyValueException
* @throws RuntimeException
* @throws ConfigurationException
* @throws NotSupportedException
*/
public function validate(bool $throw_exception=True): bool
{