1.0.0 Alpha Release #59

Merged
netkas merged 213 commits from v1.0.0_alpha into master 2023-01-29 23:27:58 +00:00
81 changed files with 186 additions and 396 deletions
Showing only changes of commit de83f53a2d - Show all commits

View file

@ -0,0 +1,37 @@
<?php
/*
* Copyright (c) Nosial 2022-2023, all rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction, including without
* limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
* Software, and to permit persons to whom the Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace ncc\Abstracts;
class BuiltinRemoteSourceType
{
/**
* The remote source indicates the package is to be
* fetched using the composer utility.
*/
const Composer = 'composer';
const All = [
self::Composer
];
}

View file

@ -34,7 +34,9 @@
use ncc\CLI\Management\PackageManagerMenu;
use ncc\CLI\Management\ProjectMenu;
use ncc\CLI\Management\SourcesMenu;
use ncc\Exceptions\AccessDeniedException;
use ncc\Exceptions\FileNotFoundException;
use ncc\Exceptions\IOException;
use ncc\Exceptions\RuntimeException;
use ncc\ncc;
use ncc\Utilities\Console;
@ -60,6 +62,8 @@
* @param $argv
* @return void
* @throws RuntimeException
* @throws AccessDeniedException
* @throws IOException
*/
public static function start($argv): void
{
@ -112,7 +116,6 @@
if(Resolver::checkLogLevel(self::$log_level, LogLevel::Debug))
{
Console::outDebug('Debug logging enabled');
/** @noinspection PhpUnhandledExceptionInspection */
Console::outDebug(sprintf('const: %s', json_encode(ncc::getConstants(), JSON_UNESCAPED_SLASHES)));
Console::outDebug(sprintf('args: %s', json_encode(self::$args, JSON_UNESCAPED_SLASHES)));
}

View file

@ -555,7 +555,6 @@ namespace ncc\CLI\Management;
$version_entry = null;
if($version_entry !== null && $package_entry !== null)
/** @noinspection PhpUnhandledExceptionInspection */
/** @noinspection PhpRedundantOptionalArgumentInspection */
$version_entry = $package_entry->getVersion($version_entry, false);

View file

@ -26,13 +26,20 @@ namespace ncc\CLI\Management;
use ncc\Abstracts\CompilerExtensionDefaultVersions;
use ncc\Abstracts\CompilerExtensions;
use ncc\Abstracts\CompilerExtensionSupportedVersions;
use ncc\Exceptions\AccessDeniedException;
use ncc\Exceptions\DirectoryNotFoundException;
use ncc\Exceptions\FileNotFoundException;
use ncc\Exceptions\InvalidPackageNameException;
use ncc\Exceptions\InvalidProjectNameException;
use ncc\Exceptions\IOException;
use ncc\Exceptions\MalformedJsonException;
use ncc\Exceptions\ProjectAlreadyExistsException;
use ncc\Exceptions\ProjectConfigurationNotFoundException;
use ncc\Managers\ProjectManager;
use ncc\Objects\CliHelpSection;
use ncc\Objects\ProjectConfiguration\Compiler;
use ncc\Utilities\Console;
use ncc\Utilities\Functions;
class ProjectMenu
{
@ -41,6 +48,12 @@ namespace ncc\CLI\Management;
*
* @param $args
* @return void
* @throws AccessDeniedException
* @throws DirectoryNotFoundException
* @throws FileNotFoundException
* @throws IOException
* @throws MalformedJsonException
* @throws ProjectConfigurationNotFoundException
*/
public static function start($args): void
{
@ -50,13 +63,17 @@ namespace ncc\CLI\Management;
}
self::displayOptions();
exit(0);
}
/**
* @param $args
* @return void
* @throws AccessDeniedException
* @throws DirectoryNotFoundException
* @throws FileNotFoundException
* @throws IOException
* @throws MalformedJsonException
* @throws ProjectConfigurationNotFoundException
*/
public static function createProject($args): void
{
@ -93,7 +110,7 @@ namespace ncc\CLI\Management;
}
// Remove basename from real_src
$real_src = \ncc\Utilities\Functions::removeBasename($real_src, $current_directory);
$real_src = Functions::removeBasename($real_src, $current_directory);
// Fetch the rest of the information needed for the project
//$compiler_extension = Console::getOptionInput($args, 'ce', 'Compiler Extension (php, java): ');
@ -242,7 +259,7 @@ namespace ncc\CLI\Management;
new CliHelpSection(['create-makefile'], 'Generates a Makefile for the project'),
];
$options_padding = \ncc\Utilities\Functions::detectParametersPadding($options) + 4;
$options_padding = Functions::detectParametersPadding($options) + 4;
Console::out('Usage: ncc project {command} [options]');
Console::out('Options:' . PHP_EOL);

View file

@ -22,16 +22,11 @@
namespace ncc\Classes\BashExtension;
use ncc\Abstracts\Runners;
use ncc\Exceptions\FileNotFoundException;
use ncc\Interfaces\RunnerInterface;
use ncc\Objects\ExecutionPointers\ExecutionPointer;
use ncc\Objects\Package\ExecutionUnit;
use ncc\Objects\ProjectConfiguration\ExecutionPolicy;
use ncc\ThirdParty\Symfony\Process\Process;
use ncc\Utilities\Base64;
use ncc\Utilities\IO;
use ncc\Utilities\PathFinder;
class BashRunner implements RunnerInterface
{

View file

@ -48,7 +48,6 @@ namespace ncc\Classes\ComposerExtension;
use ncc\Exceptions\ProjectConfigurationNotFoundException;
use ncc\Exceptions\RuntimeException;
use ncc\Exceptions\UnsupportedCompilerExtensionException;
use ncc\Exceptions\UnsupportedRunnerException;
use ncc\Exceptions\UserAbortedOperationException;
use ncc\Interfaces\ServiceSourceInterface;
use ncc\Managers\ProjectManager;
@ -99,7 +98,6 @@ namespace ncc\Classes\ComposerExtension;
* @throws ProjectConfigurationNotFoundException
* @throws RuntimeException
* @throws UnsupportedCompilerExtensionException
* @throws UnsupportedRunnerException
* @throws UserAbortedOperationException
*/
public static function fetch(RemotePackageInput $packageInput): string
@ -138,7 +136,6 @@ namespace ncc\Classes\ComposerExtension;
* @throws PackagePreparationFailedException
* @throws ProjectConfigurationNotFoundException
* @throws UnsupportedCompilerExtensionException
* @throws UnsupportedRunnerException
* @throws UserAbortedOperationException
*/
public static function fromLocal(string $path): string
@ -196,7 +193,6 @@ namespace ncc\Classes\ComposerExtension;
* @throws PackagePreparationFailedException
* @throws ProjectConfigurationNotFoundException
* @throws UnsupportedCompilerExtensionException
* @throws UnsupportedRunnerException
*/
private static function compilePackages(string $composer_lock_path): array
{

View file

@ -1,91 +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\Classes;
use ncc\Objects\PhpConfiguration;
class EnvironmentConfiguration
{
/**
* Returns an array of all the current configuration values set in this environment
*
* @return PhpConfiguration[]
*/
public static function getCurrentConfiguration(): array
{
$results = [];
foreach(ini_get_all() as $name => $config)
{
$results[$name] = PhpConfiguration::fromArray($config);
}
return $results;
}
/**
* Returns an array of only the changed configuration values
*
* @return PhpConfiguration[]
*/
public static function getChangedValues(): array
{
$results = [];
foreach(ini_get_all() as $name => $config)
{
$config = PhpConfiguration::fromArray($config);
if($config->LocalValue !== $config->GlobalValue)
{
$results[$name] = $config;
}
}
return $results;
}
/**
* @param string $file_path
* @return void
*/
public static function export(string $file_path)
{
$configuration = [];
foreach(self::getChangedValues() as $changedValue)
{
$configuration[$changedValue->getName()] = $changedValue->getValue();
}
// TODO: Implement ini writing process here
}
public static function import(string $file_path)
{
// TODO: Implement ini reading process here
$configuration = [];
foreach($configuration as $item => $value)
{
ini_set($item, $value);
}
}
}

View file

@ -66,7 +66,7 @@ namespace ncc\Classes;
* @param string $branch
* @throws GitCheckoutException
*/
public static function checkout(string $path, string $branch)
public static function checkout(string $path, string $branch): void
{
Console::outVerbose('Checking out branch' . $branch);
$process = new Process(["git", "checkout", $branch], $path);

View file

@ -204,8 +204,7 @@ namespace ncc\Classes\GithubExtension;
if ($response->StatusCode != 200)
throw new GithubServiceException(sprintf('Failed to fetch releases for the given repository. Status code: %s', $response->StatusCode));
$response_decoded = Functions::loadJson($response->Body, Functions::FORCE_ARRAY);
return $response_decoded;
return Functions::loadJson($response->Body, Functions::FORCE_ARRAY);
}
/**

View file

@ -191,14 +191,11 @@ namespace ncc\Classes;
/**
* Displays the download progress in the console
*
* @param $resource
* @param $downloadSize
* @param $downloaded
* @param $uploadSize
* @param $uploaded
* @return void
*/
public static function displayProgress($resource, $downloadSize, $downloaded, $uploadSize, $uploaded): void
public static function displayProgress($downloadSize, $downloaded): void
{
if(Main::getLogLevel() !== null)
{
@ -223,7 +220,7 @@ namespace ncc\Classes;
/**
* Takes the return headers of a cURL request and parses them into an array.
*
* @param string $headers
* @param string $input
* @return array
*/
private static function parseHeaders(string $input): array

View file

@ -22,15 +22,10 @@
namespace ncc\Classes\LuaExtension;
use ncc\Abstracts\Runners;
use ncc\Interfaces\RunnerInterface;
use ncc\Objects\ExecutionPointers\ExecutionPointer;
use ncc\Objects\Package\ExecutionUnit;
use ncc\Objects\ProjectConfiguration\ExecutionPolicy;
use ncc\ThirdParty\Symfony\Process\Process;
use ncc\Utilities\Base64;
use ncc\Utilities\IO;
use ncc\Utilities\PathFinder;
class LuaRunner implements RunnerInterface
{

View file

@ -39,9 +39,9 @@ namespace ncc\Classes\NccExtension;
use ncc\Exceptions\MalformedJsonException;
use ncc\Exceptions\PackagePreparationFailedException;
use ncc\Exceptions\ProjectConfigurationNotFoundException;
use ncc\Exceptions\RunnerExecutionException;
use ncc\Exceptions\UnsupportedCompilerExtensionException;
use ncc\Exceptions\UnsupportedProjectTypeException;
use ncc\Exceptions\UnsupportedRunnerException;
use ncc\Interfaces\CompilerInterface;
use ncc\Managers\ProjectManager;
use ncc\ncc;
@ -70,7 +70,6 @@ namespace ncc\Classes\NccExtension;
* @throws PackagePreparationFailedException
* @throws ProjectConfigurationNotFoundException
* @throws UnsupportedCompilerExtensionException
* @throws UnsupportedRunnerException
*/
public static function compile(ProjectManager $manager, string $build_configuration=BuildConfigurationValues::DefaultConfiguration): string
{
@ -162,7 +161,7 @@ namespace ncc\Classes\NccExtension;
* @throws AccessDeniedException
* @throws FileNotFoundException
* @throws IOException
* @throws UnsupportedRunnerException
* @throws RunnerExecutionException
*/
public static function compileExecutionPolicies(string $path, ProjectConfiguration $configuration): array
{

View file

@ -22,19 +22,14 @@
namespace ncc\Classes\NccExtension;
use ncc\Abstracts\Runners;
use ncc\Abstracts\Scopes;
use ncc\Exceptions\AccessDeniedException;
use ncc\Exceptions\ExecutionUnitNotFoundException;
use ncc\Exceptions\FileNotFoundException;
use ncc\Exceptions\IOException;
use ncc\Exceptions\NoAvailableUnitsException;
use ncc\Exceptions\RunnerExecutionException;
use ncc\Exceptions\UnsupportedRunnerException;
use ncc\Managers\ExecutionPointerManager;
use ncc\Objects\ExecutionPointers\ExecutionPointer;
use ncc\Objects\Package\ExecutionUnit;
use ncc\Utilities\PathFinder;
use ncc\Utilities\Resolver;
class Runner
@ -47,21 +42,19 @@ namespace ncc\Classes\NccExtension;
* @param ExecutionUnit $unit
* @return void
* @throws AccessDeniedException
* @throws UnsupportedRunnerException
* @throws ExecutionUnitNotFoundException
* @throws FileNotFoundException
* @throws IOException
* @throws NoAvailableUnitsException
* @throws RunnerExecutionException
*/
public static function temporaryExecute(string $package, string $version, ExecutionUnit $unit)
public static function temporaryExecute(string $package, string $version, ExecutionUnit $unit): void
{
if(Resolver::resolveScope() !== Scopes::System)
throw new AccessDeniedException('Cannot temporarily execute a unit with insufficent permissions');
throw new AccessDeniedException('Cannot temporarily execute a unit with insufficient permissions');
$ExecutionPointerManager = new ExecutionPointerManager();
$ExecutionPointerManager->addUnit($package, $version, $unit, true);
$ExecutionPointerManager->executeUnit($package, $version, $unit->ExecutionPolicy->Name);
$ExecutionPointerManager->cleanTemporaryUnits();;
$ExecutionPointerManager->cleanTemporaryUnits();
}
}

View file

@ -22,16 +22,11 @@
namespace ncc\Classes\PerlExtension;
use ncc\Abstracts\Runners;
use ncc\Exceptions\FileNotFoundException;
use ncc\Interfaces\RunnerInterface;
use ncc\Objects\ExecutionPointers\ExecutionPointer;
use ncc\Objects\Package\ExecutionUnit;
use ncc\Objects\ProjectConfiguration\ExecutionPolicy;
use ncc\ThirdParty\Symfony\Process\Process;
use ncc\Utilities\Base64;
use ncc\Utilities\IO;
use ncc\Utilities\PathFinder;
class PerlRunner implements RunnerInterface
{

View file

@ -39,7 +39,7 @@
use ncc\Exceptions\IOException;
use ncc\Exceptions\PackageLockException;
use ncc\Exceptions\PackagePreparationFailedException;
use ncc\Exceptions\UnsupportedRunnerException;
use ncc\Exceptions\RunnerExecutionException;
use ncc\Exceptions\VersionNotFoundException;
use ncc\Interfaces\CompilerInterface;
use ncc\Managers\PackageLockManager;
@ -304,7 +304,6 @@
* @throws BuildException
* @throws FileNotFoundException
* @throws IOException
* @throws UnsupportedRunnerException
*/
public function build(): ?Package
{
@ -443,7 +442,7 @@
* @throws AccessDeniedException
* @throws FileNotFoundException
* @throws IOException
* @throws UnsupportedRunnerException
* @throws RunnerExecutionException
*/
public function compileExecutionPolicies(): void
{

View file

@ -288,15 +288,13 @@
*
* @param string $src
* @param string $output
* @param bool $ignore_units
* @return string
* @throws AccessDeniedException
* @throws CollectorException
* @throws FileNotFoundException
* @throws IOException
* @throws NoUnitsFoundException
*/
private function generateAutoload(string $src, string $output, bool $ignore_units=true): string
private function generateAutoload(string $src, string $output): string
{
// Construct configuration
$configuration = new Config([$src]);
@ -317,10 +315,6 @@
$result = self::runCollector($factory, $configuration);
// Exception raises when there are no files in the project that can be processed by the autoloader
if(!$result->hasUnits() && !$ignore_units)
{
throw new NoUnitsFoundException('No units were found in the project');
}
$template = IO::fread($configuration->getTemplate());

View file

@ -22,19 +22,13 @@
namespace ncc\Classes\PhpExtension;
use ncc\Abstracts\Runners;
use ncc\Exceptions\AccessDeniedException;
use ncc\Exceptions\FileNotFoundException;
use ncc\Exceptions\IOException;
use ncc\Exceptions\RunnerExecutionException;
use ncc\Interfaces\RunnerInterface;
use ncc\Objects\ExecutionPointers\ExecutionPointer;
use ncc\Objects\Package\ExecutionUnit;
use ncc\Objects\ProjectConfiguration\ExecutionPolicy;
use ncc\ThirdParty\Symfony\Process\Process;
use ncc\Utilities\Base64;
use ncc\Utilities\IO;
use ncc\Utilities\PathFinder;
class PhpRunner implements RunnerInterface
{

View file

@ -22,16 +22,11 @@
namespace ncc\Classes\PythonExtension;
use ncc\Abstracts\Runners;
use ncc\Exceptions\FileNotFoundException;
use ncc\Interfaces\RunnerInterface;
use ncc\Objects\ExecutionPointers\ExecutionPointer;
use ncc\Objects\Package\ExecutionUnit;
use ncc\Objects\ProjectConfiguration\ExecutionPolicy;
use ncc\ThirdParty\Symfony\Process\Process;
use ncc\Utilities\Base64;
use ncc\Utilities\IO;
use ncc\Utilities\PathFinder;
class Python2Runner implements RunnerInterface
{

View file

@ -22,16 +22,11 @@
namespace ncc\Classes\PythonExtension;
use ncc\Abstracts\Runners;
use ncc\Exceptions\FileNotFoundException;
use ncc\Interfaces\RunnerInterface;
use ncc\Objects\ExecutionPointers\ExecutionPointer;
use ncc\Objects\Package\ExecutionUnit;
use ncc\Objects\ProjectConfiguration\ExecutionPolicy;
use ncc\ThirdParty\Symfony\Process\Process;
use ncc\Utilities\Base64;
use ncc\Utilities\IO;
use ncc\Utilities\PathFinder;
class Python3Runner implements RunnerInterface
{

View file

@ -22,16 +22,11 @@
namespace ncc\Classes\PythonExtension;
use ncc\Abstracts\Runners;
use ncc\Exceptions\FileNotFoundException;
use ncc\Interfaces\RunnerInterface;
use ncc\Objects\ExecutionPointers\ExecutionPointer;
use ncc\Objects\Package\ExecutionUnit;
use ncc\Objects\ProjectConfiguration\ExecutionPolicy;
use ncc\ThirdParty\Symfony\Process\Process;
use ncc\Utilities\Base64;
use ncc\Utilities\IO;
use ncc\Utilities\PathFinder;
class PythonRunner implements RunnerInterface
{

View file

@ -20,8 +20,6 @@
*
*/
/** @noinspection PhpPropertyOnlyWrittenInspection */
namespace ncc\Exceptions;
use Exception;

View file

@ -20,8 +20,6 @@
*
*/
/** @noinspection PhpPropertyOnlyWrittenInspection */
namespace ncc\Exceptions;
use Exception;

View file

@ -20,8 +20,6 @@
*
*/
/** @noinspection PhpPropertyOnlyWrittenInspection */
namespace ncc\Exceptions;
use Exception;

View file

@ -20,8 +20,6 @@
*
*/
/** @noinspection PhpPropertyOnlyWrittenInspection */
namespace ncc\Exceptions;
use Exception;

View file

@ -20,14 +20,13 @@
*
*/
/** @noinspection PhpPropertyOnlyWrittenInspection */
namespace ncc\Exceptions;
use Exception;
use ncc\Abstracts\ExceptionCodes;
use Throwable;
class ComposerDisabledException extends \Exception
class ComposerDisabledException extends Exception
{
/**
* @param string $message

View file

@ -20,8 +20,6 @@
*
*/
/** @noinspection PhpPropertyOnlyWrittenInspection */
namespace ncc\Exceptions;
use Exception;

View file

@ -20,9 +20,6 @@
*
*/
/** @noinspection PhpPropertyOnlyWrittenInspection */
/** @noinspection PhpMissingFieldTypeInspection */
namespace ncc\Exceptions;
use Exception;

View file

@ -22,10 +22,11 @@
namespace ncc\Exceptions;
use Exception;
use ncc\Abstracts\ExceptionCodes;
use Throwable;
class GitCheckoutException extends \Exception
class GitCheckoutException extends Exception
{
/**
* @param string $message

View file

@ -20,8 +20,6 @@
*
*/
/** @noinspection PhpPropertyOnlyWrittenInspection */
namespace ncc\Exceptions;
use Exception;

View file

@ -20,8 +20,6 @@
*
*/
/** @noinspection PhpPropertyOnlyWrittenInspection */
namespace ncc\Exceptions;
use Exception;

View file

@ -20,8 +20,6 @@
*
*/
/** @noinspection PhpPropertyOnlyWrittenInspection */
namespace ncc\Exceptions;
use Exception;

View file

@ -20,8 +20,6 @@
*
*/
/** @noinspection PhpPropertyOnlyWrittenInspection */
namespace ncc\Exceptions;
use Exception;

View file

@ -20,8 +20,6 @@
*
*/
/** @noinspection PhpPropertyOnlyWrittenInspection */
namespace ncc\Exceptions;
use Exception;

View file

@ -20,8 +20,6 @@
*
*/
/** @noinspection PhpPropertyOnlyWrittenInspection */
namespace ncc\Exceptions;
use Exception;

View file

@ -20,8 +20,6 @@
*
*/
/** @noinspection PhpPropertyOnlyWrittenInspection */
namespace ncc\Exceptions;
use Exception;

View file

@ -20,8 +20,6 @@
*
*/
/** @noinspection PhpPropertyOnlyWrittenInspection */
namespace ncc\Exceptions;
use Exception;

View file

@ -20,8 +20,6 @@
*
*/
/** @noinspection PhpPropertyOnlyWrittenInspection */
namespace ncc\Exceptions;
use Exception;

View file

@ -20,8 +20,6 @@
*
*/
/** @noinspection PhpPropertyOnlyWrittenInspection */
namespace ncc\Exceptions;
use Exception;

View file

@ -20,8 +20,6 @@
*
*/
/** @noinspection PhpPropertyOnlyWrittenInspection */
namespace ncc\Exceptions;
use Exception;

View file

@ -22,10 +22,11 @@
namespace ncc\Exceptions;
use Exception;
use ncc\Abstracts\ExceptionCodes;
use Throwable;
class PackageFetchException extends \Exception
class PackageFetchException extends Exception
{
/**
* @param string $message

View file

@ -20,8 +20,6 @@
*
*/
/** @noinspection PhpPropertyOnlyWrittenInspection */
namespace ncc\Exceptions;
use Exception;

View file

@ -20,8 +20,6 @@
*
*/
/** @noinspection PhpPropertyOnlyWrittenInspection */
namespace ncc\Exceptions;
use Exception;

View file

@ -20,8 +20,6 @@
*
*/
/** @noinspection PhpPropertyOnlyWrittenInspection */
namespace ncc\Exceptions;
use Exception;

View file

@ -20,8 +20,6 @@
*
*/
/** @noinspection PhpPropertyOnlyWrittenInspection */
namespace ncc\Exceptions;
use Exception;

View file

@ -20,8 +20,6 @@
*
*/
/** @noinspection PhpPropertyOnlyWrittenInspection */
namespace ncc\Exceptions;
use Exception;

View file

@ -20,8 +20,6 @@
*
*/
/** @noinspection PhpPropertyOnlyWrittenInspection */
namespace ncc\Exceptions;
use Exception;

View file

@ -20,8 +20,6 @@
*
*/
/** @noinspection PhpPropertyOnlyWrittenInspection */
namespace ncc\Exceptions;
use Exception;

View file

@ -20,8 +20,6 @@
*
*/
/** @noinspection PhpPropertyOnlyWrittenInspection */
namespace ncc\Exceptions;
use Exception;

View file

@ -20,8 +20,6 @@
*
*/
/** @noinspection PhpPropertyOnlyWrittenInspection */
namespace ncc\Exceptions;
use Exception;

View file

@ -20,8 +20,6 @@
*
*/
/** @noinspection PhpPropertyOnlyWrittenInspection */
namespace ncc\Exceptions;
use Exception;

View file

@ -20,8 +20,6 @@
*
*/
/** @noinspection PhpPropertyOnlyWrittenInspection */
namespace ncc\Exceptions;
use Exception;

View file

@ -20,8 +20,6 @@
*
*/
/** @noinspection PhpPropertyOnlyWrittenInspection */
namespace ncc\Exceptions;
use Exception;

View file

@ -210,8 +210,11 @@ namespace ncc\ZiProto;
case 0xc3: return true;
// bin
case 0xd9:
case 0xc4: return $this->decodeStrData($this->decodeUint8());
case 0xda:
case 0xc5: return $this->decodeStrData($this->decodeUint16());
case 0xdb:
case 0xc6: return $this->decodeStrData($this->decodeUint32());
// float
@ -231,9 +234,6 @@ namespace ncc\ZiProto;
case 0xd3: return $this->decodeInt64();
// str
case 0xd9: return $this->decodeStrData($this->decodeUint8());
case 0xda: return $this->decodeStrData($this->decodeUint16());
case 0xdb: return $this->decodeStrData($this->decodeUint32());
// array
case 0xdc: return $this->decodeArrayData($this->decodeUint16());
@ -372,7 +372,7 @@ namespace ncc\ZiProto;
}
/**
* @return bool|string
* @return string
*/
public function decodeStr()
{
@ -408,7 +408,7 @@ namespace ncc\ZiProto;
}
/**
* @return bool|string
* @return string
*/
public function decodeBin()
{

View file

@ -61,7 +61,7 @@ namespace ncc\ZiProto;
{
$self = new self();
$self->bigIntMode = self::getSingleOption('bigint', $bitmask,
$self->bigIntMode = self::getSingleOption($bitmask,
Options::BIGINT_AS_STR |
Options::BIGINT_AS_GMP |
Options::BIGINT_AS_EXCEPTION
@ -87,12 +87,11 @@ namespace ncc\ZiProto;
}
/**
* @param string $name
* @param int $bitmask
* @param int $validBitmask
* @return int
*/
private static function getSingleOption(string $name, int $bitmask, int $validBitmask) : int
private static function getSingleOption(int $bitmask, int $validBitmask) : int
{
$option = $bitmask & $validBitmask;
if ($option === ($option & -$option))
@ -112,6 +111,6 @@ namespace ncc\ZiProto;
$validOptions[] = __CLASS__.'::'.$map[$i];
}
throw InvalidOptionException::outOfRange($name, $validOptions);
throw InvalidOptionException::outOfRange('bigint', $validOptions);
}
}

View file

@ -112,7 +112,7 @@ namespace ncc\ZiProto;
* @param $value
* @return false|string
*/
public function encode($value)
public function encode($value): false|string
{
if (is_int($value))
{
@ -185,7 +185,7 @@ namespace ncc\ZiProto;
/**
* @return string
*/
public function encodeNil()
public function encodeNil(): string
{
return "\xc0";
}
@ -194,7 +194,7 @@ namespace ncc\ZiProto;
* @param $bool
* @return string
*/
public function encodeBool($bool)
public function encodeBool($bool): string
{
return $bool ? "\xc3" : "\xc2";
}
@ -203,7 +203,7 @@ namespace ncc\ZiProto;
* @param $int
* @return string
*/
public function encodeInt($int)
public function encodeInt($int): string
{
if ($int >= 0)
{
@ -257,7 +257,7 @@ namespace ncc\ZiProto;
* @param $float
* @return string
*/
public function encodeFloat($float)
public function encodeFloat($float): string
{
return $this->isForceFloat32
? "\xca". pack('G', $float)
@ -268,7 +268,7 @@ namespace ncc\ZiProto;
* @param $str
* @return string
*/
public function encodeStr($str)
public function encodeStr($str): string
{
$length = strlen($str);
@ -294,7 +294,7 @@ namespace ncc\ZiProto;
* @param $str
* @return string
*/
public function encodeBin($str)
public function encodeBin($str): string
{
$length = strlen($str);
@ -313,9 +313,9 @@ namespace ncc\ZiProto;
/**
* @param $array
* @return false|string
* @return string
*/
public function encodeArray($array)
public function encodeArray($array): string
{
$data = $this->encodeArrayHeader(count($array));
@ -331,7 +331,7 @@ namespace ncc\ZiProto;
* @param $size
* @return string
*/
public function encodeArrayHeader($size)
public function encodeArrayHeader($size): string
{
if ($size <= 0xf)
{
@ -348,9 +348,9 @@ namespace ncc\ZiProto;
/**
* @param $map
* @return false|string
* @return string
*/
public function encodeMap($map)
public function encodeMap($map): string
{
$data = $this->encodeMapHeader(count($map));
@ -391,7 +391,7 @@ namespace ncc\ZiProto;
* @param $size
* @return string
*/
public function encodeMapHeader($size)
public function encodeMapHeader($size): string
{
if ($size <= 0xf)
{
@ -411,7 +411,7 @@ namespace ncc\ZiProto;
* @param $data
* @return string
*/
public function encodeExt($type, $data)
public function encodeExt($type, $data): string
{
$length = strlen($data);

View file

@ -34,7 +34,7 @@ namespace ncc\ncc\ZiProto\TypeTransformer;
/**
* @param Packet $packer
* @param $value
* @return string
* @return string|null
*/
public function pack(Packet $packer, $value): ?string
{

View file

@ -40,5 +40,5 @@ namespace ncc\ncc\ZiProto\TypeTransformer;
* @param int $extLength
* @return mixed
*/
public function decode(BufferStream $stream, int $extLength);
public function decode(BufferStream $stream, int $extLength): mixed;
}

View file

@ -27,7 +27,6 @@ namespace ncc\Interfaces;
use ncc\Exceptions\BuildException;
use ncc\Exceptions\FileNotFoundException;
use ncc\Exceptions\IOException;
use ncc\Exceptions\UnsupportedRunnerException;
use ncc\Objects\Package;
use ncc\Objects\ProjectConfiguration;
@ -57,7 +56,6 @@ namespace ncc\Interfaces;
* @throws BuildException
* @throws FileNotFoundException
* @throws IOException
* @throws UnsupportedRunnerException
*/
public function build(): ?Package;
@ -88,7 +86,6 @@ namespace ncc\Interfaces;
* @throws AccessDeniedException
* @throws FileNotFoundException
* @throws IOException
* @throws UnsupportedRunnerException
*/
public function compileExecutionPolicies(): void;

View file

@ -25,11 +25,8 @@ namespace ncc\Interfaces;
use ncc\Exceptions\AccessDeniedException;
use ncc\Exceptions\FileNotFoundException;
use ncc\Exceptions\IOException;
use ncc\Exceptions\RunnerExecutionException;
use ncc\Objects\ExecutionPointers\ExecutionPointer;
use ncc\Objects\Package\ExecutionUnit;
use ncc\Objects\ProjectConfiguration\ExecutionPolicy;
use ncc\ThirdParty\Symfony\Process\Process;
interface RunnerInterface
{

View file

@ -36,13 +36,11 @@
use ncc\Classes\PythonExtension\Python3Runner;
use ncc\Classes\PythonExtension\PythonRunner;
use ncc\Exceptions\AccessDeniedException;
use ncc\Exceptions\ExecutionUnitNotFoundException;
use ncc\Exceptions\FileNotFoundException;
use ncc\Exceptions\InvalidScopeException;
use ncc\Exceptions\IOException;
use ncc\Exceptions\NoAvailableUnitsException;
use ncc\Exceptions\RunnerExecutionException;
use ncc\Exceptions\UnsupportedRunnerException;
use ncc\Objects\ExecutionPointers;
use ncc\Objects\Package;
use ncc\Objects\Package\ExecutionUnit;
@ -166,9 +164,8 @@
* @throws AccessDeniedException
* @throws FileNotFoundException
* @throws IOException
* @throws UnsupportedRunnerException
* @throws RunnerExecutionException
* @noinspection PhpUnused
* @noinspection DuplicatedCode
*/
public function addUnit(string $package, string $version, ExecutionUnit $unit, bool $temporary=false): void
{
@ -209,7 +206,7 @@
Runners::python2 => Python2Runner::getFileExtension(),
Runners::python3 => Python3Runner::getFileExtension(),
Runners::lua => LuaRunner::getFileExtension(),
default => throw new UnsupportedRunnerException('The runner \'' . $unit->ExecutionPolicy->Runner . '\' is not supported'),
default => throw new RunnerExecutionException('The runner \'' . $unit->ExecutionPolicy->Runner . '\' is not supported'),
};
Console::outDebug(sprintf('bin_file=%s', $bin_file));
@ -258,7 +255,6 @@
* @throws AccessDeniedException
* @throws FileNotFoundException
* @throws IOException
* @noinspection DuplicatedCode
*/
public function removeUnit(string $package, string $version, string $name): bool
{
@ -347,12 +343,10 @@
* @param array $args
* @return int
* @throws AccessDeniedException
* @throws ExecutionUnitNotFoundException
* @throws FileNotFoundException
* @throws IOException
* @throws NoAvailableUnitsException
* @throws RunnerExecutionException
* @throws UnsupportedRunnerException
*/
public function executeUnit(string $package, string $version, string $name, array $args=[]): int
{
@ -368,7 +362,7 @@
$unit = $execution_pointers->getUnit($name);
if($unit == null)
throw new ExecutionUnitNotFoundException('The execution unit \'' . $name . '\' was not found for \'' . $package . '=' .$version .'\'');
throw new RunnerExecutionException('The execution unit \'' . $name . '\' was not found for \'' . $package . '=' .$version .'\'');
Console::outDebug(sprintf('unit=%s', $unit->ExecutionPolicy->Name));
Console::outDebug(sprintf('runner=%s', $unit->ExecutionPolicy->Runner));
@ -470,12 +464,10 @@
* @param string $unit_name
* @return void
* @throws AccessDeniedException
* @throws ExecutionUnitNotFoundException
* @throws FileNotFoundException
* @throws IOException
* @throws NoAvailableUnitsException
* @throws RunnerExecutionException
* @throws UnsupportedRunnerException
*/
public function temporaryExecute(Package $package, string $unit_name): void
{
@ -522,12 +514,10 @@
* @param Process|null $process
* @return bool
* @throws AccessDeniedException
* @throws ExecutionUnitNotFoundException
* @throws FileNotFoundException
* @throws IOException
* @throws NoAvailableUnitsException
* @throws RunnerExecutionException
* @throws UnsupportedRunnerException
*/
public function handleExit(string $package, string $version, ExitHandle $exitHandle, ?Process $process=null): bool
{

View file

@ -20,7 +20,6 @@
*
*/
/** @noinspection PhpPropertyOnlyWrittenInspection */
/** @noinspection PhpMissingFieldTypeInspection */
namespace ncc\Managers;

View file

@ -51,6 +51,7 @@
use ncc\Exceptions\PackageLockException;
use ncc\Exceptions\PackageNotFoundException;
use ncc\Exceptions\PackageParsingException;
use ncc\Exceptions\RunnerExecutionException;
use ncc\Exceptions\SymlinkException;
use ncc\Exceptions\UnsupportedCompilerExtensionException;
use ncc\Exceptions\VersionNotFoundException;
@ -109,6 +110,7 @@
* @throws FileNotFoundException
* @throws IOException
* @throws InstallationException
* @throws InvalidPackageNameException
* @throws InvalidScopeException
* @throws MissingDependencyException
* @throws NotImplementedException
@ -116,11 +118,10 @@
* @throws PackageLockException
* @throws PackageNotFoundException
* @throws PackageParsingException
* @throws UnsupportedCompilerExtensionException
* @throws UnsupportedRunnerException
* @throws VersionNotFoundException
* @throws InvalidPackageNameException
* @throws RunnerExecutionException
* @throws SymlinkException
* @throws UnsupportedCompilerExtensionException
* @throws VersionNotFoundException
*/
public function install(string $package_path, ?Entry $entry=null, array $options=[]): string
{
@ -604,6 +605,7 @@
* @throws SymlinkException
* @throws UnsupportedCompilerExtensionException
* @throws VersionNotFoundException
* @throws RunnerExecutionException
*/
private function processDependency(Dependency $dependency, Package $package, string $package_path, ?Entry $entry=null): void
{
@ -930,7 +932,7 @@
$paths->getDataPath() . DIRECTORY_SEPARATOR . 'assembly' =>
ZiProto::encode($package->Assembly->toArray(true)),
$paths->getDataPath() . DIRECTORY_SEPARATOR . 'ext' =>
ZiProto::encode($package->Header->CompilerExtension->toArray(true)),
ZiProto::encode($package->Header->CompilerExtension->toArray()),
$paths->getDataPath() . DIRECTORY_SEPARATOR . 'const' =>
ZiProto::encode($package->Header->RuntimeConstants),
$paths->getDataPath() . DIRECTORY_SEPARATOR . 'dependencies' =>

View file

@ -40,7 +40,6 @@
use ncc\Exceptions\ProjectAlreadyExistsException;
use ncc\Exceptions\ProjectConfigurationNotFoundException;
use ncc\Exceptions\UnsupportedCompilerExtensionException;
use ncc\Exceptions\UnsupportedRunnerException;
use ncc\Objects\ProjectConfiguration;
use ncc\Objects\ProjectConfiguration\Compiler;
use ncc\ThirdParty\Symfony\Uid\Uuid;
@ -192,14 +191,10 @@
// Process options
foreach($options as $option)
{
switch($option)
{
case InitializeProjectOptions::CREATE_SOURCE_DIRECTORY:
if(!file_exists($this->ProjectConfiguration->Build->SourcePath))
{
if ($option == InitializeProjectOptions::CREATE_SOURCE_DIRECTORY) {
if (!file_exists($this->ProjectConfiguration->Build->SourcePath)) {
mkdir($this->ProjectConfiguration->Build->SourcePath);
}
break;
}
}
}
@ -227,7 +222,7 @@
* @throws FileNotFoundException
* @throws IOException
*/
public function load()
public function load(): void
{
if(!file_exists($this->ProjectFilePath) && !is_file($this->ProjectFilePath))
throw new ProjectConfigurationNotFoundException('The project configuration file \'' . $this->ProjectFilePath . '\' was not found');
@ -241,7 +236,7 @@
* @return void
* @throws MalformedJsonException
*/
public function save()
public function save(): void
{
if(!$this->projectLoaded())
return;
@ -294,7 +289,6 @@
* @throws BuildException
* @throws PackagePreparationFailedException
* @throws UnsupportedCompilerExtensionException
* @throws UnsupportedRunnerException
*/
public function build(string $build_configuration=BuildConfigurationValues::DefaultConfiguration): string
{

View file

@ -56,7 +56,6 @@
*/
public function __construct()
{
/** @noinspection PhpUnhandledExceptionInspection */
$this->DefinedSourcesPath = PathFinder::getRemoteSources(Scopes::System);
$this->load();

View file

@ -282,28 +282,6 @@
}
}
/**
* Sets the package as unregistered
*
* @param string $package
* @return void
* @throws AccessDeniedException
* @throws SymlinkException
*/
private function setAsUnregistered(string $package): void
{
foreach($this->SymlinkDictionary as $key => $entry)
{
if($entry->Package === $package)
{
$entry->Registered = false;
$this->SymlinkDictionary[$key] = $entry;
$this->save();
return;
}
}
}
/**
* Syncs the symlink dictionary with the filesystem
*

View file

@ -114,7 +114,7 @@ namespace ncc\Objects;
*/
public function setValue(string $value, bool $readonly=false): void
{
if($this->Readonly == true)
if($this->Readonly)
{
throw new ConstantReadonlyException('Cannot set value to the constant \'' . $this->getFullName() . '\', constant is readonly');
}

View file

@ -129,7 +129,7 @@
* @param Dependency $dependency
* @return void
*/
public function addDependency(Dependency $dependency)
public function addDependency(Dependency $dependency): void
{
foreach($this->Dependencies as $dep)
{
@ -149,7 +149,7 @@
* @param string $name
* @return void
*/
private function removeDependency(string $name)
private function removeDependency(string $name): void
{
foreach($this->Dependencies as $key => $dep)
{

View file

@ -84,7 +84,7 @@
public function toArray(bool $bytecode=false): array
{
return [
($bytecode ? Functions::cbc('compiler_extension') : 'compiler_extension') => $this->CompilerExtension->toArray($bytecode),
($bytecode ? Functions::cbc('compiler_extension') : 'compiler_extension') => $this->CompilerExtension->toArray(),
($bytecode ? Functions::cbc('runtime_constants') : 'runtime_constants') => $this->RuntimeConstants,
($bytecode ? Functions::cbc('compiler_version') : 'compiler_version') => $this->CompilerVersion,
($bytecode ? Functions::cbc('update_source') : 'update_source') => ($this->UpdateSource?->toArray($bytecode) ?? null),

View file

@ -239,7 +239,7 @@
if(!file_exists($path) && Resolver::resolveScope() == Scopes::System)
{
$filesystem = new Filesystem();
$filesystem->mkdir($path, 0777);
$filesystem->mkdir($path);
}
return $path;

View file

@ -112,7 +112,7 @@
return [
($bytecode ? Functions::cbc('version') : 'version') => $this->Version,
($bytecode ? Functions::cbc('compiler') : 'compiler') => $this->Compiler->toArray($bytecode),
($bytecode ? Functions::cbc('compiler') : 'compiler') => $this->Compiler->toArray(),
($bytecode ? Functions::cbc('dependencies') : 'dependencies') => $dependencies,
($bytecode ? Functions::cbc('execution_units') : 'execution_units') => $execution_units,
($bytecode ? Functions::cbc('main_execution_policy') : 'main_execution_policy') => $this->MainExecutionPolicy,

View file

@ -145,10 +145,9 @@
/**
* Returns an array representation of the object
*
* @param bool $bytecode
* @return array
*/
public function toArray(bool $bytecode=false): array
public function toArray(): array
{
$return_results = [];
if($this->Extension !== null && strlen($this->Extension) > 0)

View file

@ -66,10 +66,9 @@
public $ExitHandlers;
/**
* @param bool $throw_exception
* @return bool
*/
public function validate(bool $throw_exception=True): bool
public function validate(): bool
{
// TODO: Implement validation method
return true;

View file

@ -88,7 +88,7 @@
{
$ReturnResults = [];
$ReturnResults[($bytecode ? Functions::cbc('compiler') : 'compiler')] = $this->Compiler->toArray($bytecode);
$ReturnResults[($bytecode ? Functions::cbc('compiler') : 'compiler')] = $this->Compiler->toArray();
$ReturnResults[($bytecode ? Functions::cbc('options') : 'options')] = $this->Options;
if($this->UpdateSource !== null)

View file

@ -59,8 +59,6 @@
namespace ncc\Objects;
use ncc\Abstracts\ProjectType;
class ProjectDetectionResults
{
/**

View file

@ -174,7 +174,7 @@
$package = self::getPackageManager()->getPackage($package);
if($package == null)
throw new PackageNotFoundException(sprintf('Package %s not found', $package));
throw new PackageNotFoundException('Package not found (null entry error, possible bug)');
return $package->getDataPath();
}

View file

@ -47,8 +47,8 @@ namespace ncc\Utilities;
use ncc\Exceptions\InvalidScopeException;
use ncc\Exceptions\IOException;
use ncc\Exceptions\MalformedJsonException;
use ncc\Exceptions\RunnerExecutionException;
use ncc\Exceptions\UnsupportedArchiveException;
use ncc\Exceptions\UnsupportedRunnerException;
use ncc\Managers\ConfigurationManager;
use ncc\Managers\CredentialManager;
use ncc\Managers\PackageLockManager;
@ -298,10 +298,10 @@ namespace ncc\Utilities;
* @param string $path
* @param ExecutionPolicy $policy
* @return ExecutionUnit
* @throws UnsupportedRunnerException
* @throws AccessDeniedException
* @throws FileNotFoundException
* @throws IOException
* @throws RunnerExecutionException
*/
public static function compileRunner(string $path, ExecutionPolicy $policy): ExecutionUnit
{
@ -313,7 +313,7 @@ namespace ncc\Utilities;
Runners::python2 => Python2Runner::processUnit($path, $policy),
Runners::python3 => Python3Runner::processUnit($path, $policy),
Runners::lua => LuaRunner::processUnit($path, $policy),
default => throw new UnsupportedRunnerException('The runner \'' . $policy->Runner . '\' is not supported'),
default => throw new RunnerExecutionException('The runner \'' . $policy->Runner . '\' is not supported'),
};
}
@ -676,21 +676,13 @@ namespace ncc\Utilities;
if (!in_array($mimeType, $supportedTypes))
throw new UnsupportedArchiveException("Unsupported archive type: $mimeType");
switch($mimeType)
{
case 'application/zip':
$command = [$unzip_executable, $path, '-d', $out_path];
break;
case 'application/x-tar':
$command = [$tar_executable, '--verbose', '-xf', $path, '-C', $out_path];
break;
case 'application/x-gzip':
$command = [$tar_executable, '--verbose', '-xzf', $path, '-C', $out_path];
break;
case 'application/x-bzip2':
$command = [$tar_executable, '--verbose', '-xjf', $path, '-C', $out_path];
break;
}
$command = match ($mimeType) {
'application/zip' => [$unzip_executable, $path, '-d', $out_path],
'application/x-tar' => [$tar_executable, '--verbose', '-xf', $path, '-C', $out_path],
'application/x-gzip' => [$tar_executable, '--verbose', '-xzf', $path, '-C', $out_path],
'application/x-bzip2' => [$tar_executable, '--verbose', '-xjf', $path, '-C', $out_path],
default => throw new UnsupportedArchiveException("Unsupported archive type: $mimeType"),
};
Console::out("Extracting archive $path");
$process = new Process($command);
@ -746,7 +738,6 @@ namespace ncc\Utilities;
$minor = (string)null;
$patch = (string)null;
$buildmetadata = (string)null;
if(count($parts) >= 1)
$major = $parts[0];
if(count($parts) >= 2)
@ -945,7 +936,7 @@ namespace ncc\Utilities;
* @param string $input
* @return float|int|mixed|string
*/
public static function stringTypeCast(string $input)
public static function stringTypeCast(string $input): mixed
{
if (is_numeric($input))
{
@ -969,7 +960,7 @@ namespace ncc\Utilities;
* @return void
* @throws InvalidScopeException
*/
public static function finalizePermissions()
public static function finalizePermissions(): void
{
if(Resolver::resolveScope() !== Scopes::System)
return;

View file

@ -292,7 +292,6 @@
* Detects the project type from the specified path
*
* @param string $path
* @param array $exlucde
* @return ProjectDetectionResults
*/
public static function detectProjectType(string $path): ProjectDetectionResults

View file

@ -48,8 +48,7 @@ namespace ncc\Utilities;
if ($beautify) $input = self::beautifyFilename($input);
// maximize filename length to 255 bytes http://serverfault.com/a/9548/44086
$ext = pathinfo($input, PATHINFO_EXTENSION);
$input = mb_strcut(pathinfo($input, PATHINFO_FILENAME), 0, 255 - ($ext ? strlen($ext) + 1 : 0), mb_detect_encoding($input)) . ($ext ? '.' . $ext : '');
return $input;
return mb_strcut(pathinfo($input, PATHINFO_FILENAME), 0, 255 - ($ext ? strlen($ext) + 1 : 0), mb_detect_encoding($input)) . ($ext ? '.' . $ext : '');
}
/**
@ -77,8 +76,6 @@ namespace ncc\Utilities;
// lowercase for windows/unix interoperability http://support.microsoft.com/kb/100625
$input = mb_strtolower($input, mb_detect_encoding($input));
// ".file-name.-" becomes "file-name"
$input = trim($input, '.-');
return $input;
return trim($input, '.-');
}
}

View file

@ -20,5 +20,7 @@
*
*/
use ncc\CLI\Main;
require('autoload.php');
\ncc\CLI\Main::start($argv);
Main::start($argv);

View file

@ -38,7 +38,7 @@ namespace ncc;
{
/**
* The cache'd version of the version information object.
* The cached version of the version information object.
*
* @var NccVersionInformation|null
*/
@ -98,7 +98,9 @@ namespace ncc;
* Initializes the NCC environment
*
* @return bool
* @throws Exceptions\FileNotFoundException
* @throws AccessDeniedException
* @throws FileNotFoundException
* @throws IOException
* @throws RuntimeException
*/
public static function initialize(): bool
@ -146,7 +148,7 @@ namespace ncc;
*/
public static function getConstants(): array
{
if(defined('NCC_INIT') == false)
if(!defined('NCC_INIT'))
{
throw new RuntimeException('NCC Must be initialized before executing ' . get_called_class() . '::getConstants()');
}