From 24fdbd05bf1fbb16d3572f53c9426710bdca9b7e Mon Sep 17 00:00:00 2001 From: Netkas Date: Mon, 24 Oct 2022 16:42:41 -0400 Subject: [PATCH] Deleted unused Php.php Updated SpecialFormat to be more consistent in it's naming Updated BuildMenu.php to take in arguments `path` or `p` for building projects. Added CLI check for Console Out methods Finalized Compiler.php Namespace import cleanup Namespace import cleanup Added Todo comments Added inline operator check Added Abstract Class \ncc\Abstracts > SpecialFormat Added validation for constants Increased Constant character limit to 64 characters Increased Character Limitation for some properties in Assembly.php Updated validate() method in ProjectConfiguration.php Added save() method to \ncc\Objects > Package Minor changes in code structure --- ...mponentFlags.php => ComponentDataType.php} | 2 +- src/ncc/Abstracts/RegexPatterns.php | 2 +- src/ncc/Abstracts/SpecialFormat.php | 32 +++++ src/ncc/CLI/BuildMenu.php | 54 ++++++-- src/ncc/Classes/Compilers/Php.php | 40 ------ src/ncc/Classes/PhpExtension/Compiler.php | 123 ++++++++++++------ src/ncc/Objects/Package.php | 22 +++- src/ncc/Objects/ProjectConfiguration.php | 18 +++ .../Objects/ProjectConfiguration/Assembly.php | 16 +-- .../Objects/ProjectConfiguration/Build.php | 14 +- src/ncc/Utilities/Console.php | 35 +++-- src/ncc/Utilities/Functions.php | 3 - src/ncc/Utilities/PathFinder.php | 1 - 13 files changed, 246 insertions(+), 116 deletions(-) rename src/ncc/Abstracts/{ComponentFlags.php => ComponentDataType.php} (95%) create mode 100644 src/ncc/Abstracts/SpecialFormat.php delete mode 100644 src/ncc/Classes/Compilers/Php.php diff --git a/src/ncc/Abstracts/ComponentFlags.php b/src/ncc/Abstracts/ComponentDataType.php similarity index 95% rename from src/ncc/Abstracts/ComponentFlags.php rename to src/ncc/Abstracts/ComponentDataType.php index 17f2de8..ce39ef2 100644 --- a/src/ncc/Abstracts/ComponentFlags.php +++ b/src/ncc/Abstracts/ComponentDataType.php @@ -2,7 +2,7 @@ namespace ncc\Abstracts; - abstract class ComponentFlags + abstract class ComponentDataType { /** * Indicates whether the component is represented as an AST representation diff --git a/src/ncc/Abstracts/RegexPatterns.php b/src/ncc/Abstracts/RegexPatterns.php index 42d2d58..7c53bd1 100644 --- a/src/ncc/Abstracts/RegexPatterns.php +++ b/src/ncc/Abstracts/RegexPatterns.php @@ -22,5 +22,5 @@ const WindowsPath = '/^(([%][^\/:*?<>""|]*[%])|([a-zA-Z][:])|(\\\\))((\\\\{1})|((\\\\{1})[^\\\\]([^\/:*?<>""|]*))+)$/m'; - const ConstantName = '/^([^\x00-\x7F]|[\w_\ \.\+\-]){2,16}$/'; + const ConstantName = '/^([^\x00-\x7F]|[\w_\ \.\+\-]){2,64}$/'; } \ No newline at end of file diff --git a/src/ncc/Abstracts/SpecialFormat.php b/src/ncc/Abstracts/SpecialFormat.php new file mode 100644 index 0000000..ab80064 --- /dev/null +++ b/src/ncc/Abstracts/SpecialFormat.php @@ -0,0 +1,32 @@ +Build->DefaultConfiguration; + } + try { $ProjectConfiguration->Build->getBuildConfiguration($build_configuration); @@ -94,18 +121,18 @@ Console::out( ' ===== BUILD INFO ===== ' . PHP_EOL . - ' Package Name: ' . $ProjectConfiguration->Assembly->Package . PHP_EOL . - ' Version: ' . $ProjectConfiguration->Assembly->Version . PHP_EOL . - ' Compiler Extension: ' . $ProjectConfiguration->Project->Compiler->Extension . PHP_EOL . - ' Compiler Version: ' . $ProjectConfiguration->Project->Compiler->MaximumVersion . ' - ' . $ProjectConfiguration->Project->Compiler->MinimumVersion . PHP_EOL . - ' Build Configuration: ' . $build_configuration . PHP_EOL + ' Package Name: ' . $ProjectConfiguration->Assembly->Package . PHP_EOL . + ' Version: ' . $ProjectConfiguration->Assembly->Version . PHP_EOL . + ' Compiler Extension: ' . $ProjectConfiguration->Project->Compiler->Extension . PHP_EOL . + ' Compiler Version: ' . $ProjectConfiguration->Project->Compiler->MaximumVersion . ' - ' . $ProjectConfiguration->Project->Compiler->MinimumVersion . PHP_EOL . + ' Build Configuration: ' . $build_configuration . PHP_EOL ); Console::out('Preparing package'); try { - $Compiler->prepare([], getcwd(), $build_configuration); + $Compiler->prepare($project_path, $build_configuration); } catch (Exception $e) { @@ -113,9 +140,11 @@ return; } + Console::out('Compiling package'); + try { - $Compiler->build([], getcwd()); + $Compiler->build($project_path); } catch (Exception $e) { @@ -136,6 +165,7 @@ $options = [ new CliHelpSection(['help'], 'Displays this help menu about the value command'), new CliHelpSection(['build'], 'Builds the current project using the default build configuration'), + new CliHelpSection(['build', '--path', '-p'], 'Builds the project in the specified path that contains project.json'), new CliHelpSection(['build', '--config'], 'Builds the current project with a specified build configuration') ]; diff --git a/src/ncc/Classes/Compilers/Php.php b/src/ncc/Classes/Compilers/Php.php deleted file mode 100644 index 8d587f4..0000000 --- a/src/ncc/Classes/Compilers/Php.php +++ /dev/null @@ -1,40 +0,0 @@ -project = $project; - $this->autoloader = new AutoloaderGenerator($project); - } - - public function prepare(array $options) - { - // TODO: Implement prepare() method. - } - - public function build(array $options) - { - // TODO: Implement build() method. - } - } \ No newline at end of file diff --git a/src/ncc/Classes/PhpExtension/Compiler.php b/src/ncc/Classes/PhpExtension/Compiler.php index 99f2832..4257002 100644 --- a/src/ncc/Classes/PhpExtension/Compiler.php +++ b/src/ncc/Classes/PhpExtension/Compiler.php @@ -4,9 +4,10 @@ namespace ncc\Classes\PhpExtension; + use Exception; use FilesystemIterator; use ncc\Abstracts\ComponentFileExtensions; - use ncc\Abstracts\ComponentFlags; + use ncc\Abstracts\ComponentDataType; use ncc\Abstracts\Options\BuildConfigurationValues; use ncc\Exceptions\BuildConfigurationNotFoundException; use ncc\Exceptions\BuildException; @@ -17,11 +18,12 @@ use ncc\Objects\ProjectConfiguration; use ncc\ThirdParty\nikic\PhpParser\Error; use ncc\ThirdParty\nikic\PhpParser\ParserFactory; + use ncc\ThirdParty\Symfony\Filesystem\Exception\IOException; + use ncc\ThirdParty\Symfony\Filesystem\Filesystem; use ncc\ThirdParty\theseer\DirectoryScanner\DirectoryScanner; - use ncc\ThirdParty\theseer\DirectoryScanner\Exception; + use ncc\Utilities\Base64; use ncc\Utilities\Console; use ncc\Utilities\Functions; - use ncc\ZiProto\ZiProto; use SplFileInfo; class Compiler implements CompilerInterface @@ -36,6 +38,11 @@ */ private $package; + /** + * @var ProjectConfiguration\BuildConfiguration|null + */ + private $selected_build_configuration; + /** * @param ProjectConfiguration $project */ @@ -48,14 +55,23 @@ * Prepares the PHP package by generating the Autoloader and detecting all components & resources * This function must be called before calling the build function, otherwise the operation will fail * - * @param array $options * @param string $path * @param string $build_configuration * @return void * @throws PackagePreparationFailedException */ - public function prepare(array $options, string $path, string $build_configuration=BuildConfigurationValues::DefaultConfiguration): void + public function prepare(string $path, string $build_configuration=BuildConfigurationValues::DefaultConfiguration): void { + try + { + /** @noinspection PhpRedundantOptionalArgumentInspection */ + $this->project->validate(True); + } + catch (Exception $e) + { + throw new PackagePreparationFailedException($e->getMessage(), $e); + } + // Auto-select the default build configuration if($build_configuration == BuildConfigurationValues::DefaultConfiguration) { @@ -65,7 +81,7 @@ // Select the build configuration try { - $selected_build_configuration = $this->project->Build->getBuildConfiguration($build_configuration); + $this->selected_build_configuration = $this->project->Build->getBuildConfiguration($build_configuration); } catch (BuildConfigurationNotFoundException $e) { @@ -77,7 +93,11 @@ $this->package->Assembly = $this->project->Assembly; $this->package->Dependencies = $this->project->Build->Dependencies; - $this->package->Header->RuntimeConstants = $selected_build_configuration->DefineConstants; + // Add both the defined constants from the build configuration and the global constants. + // Global constants are overridden + $this->package->Header->RuntimeConstants = array_merge($this->selected_build_configuration->DefineConstants, $this->package->Header->RuntimeConstants); + $this->package->Header->RuntimeConstants = array_merge($this->project->Build->DefineConstants, $this->package->Header->RuntimeConstants); + $this->package->Header->CompilerExtension = $this->project->Project->Compiler; $this->package->Header->CompilerVersion = NCC_VERSION_NUMBER; @@ -101,7 +121,7 @@ // Include file components that can be compiled $DirectoryScanner->setIncludes(ComponentFileExtensions::Php); - $DirectoryScanner->setExcludes($selected_build_configuration->ExcludeFiles); + $DirectoryScanner->setExcludes($this->selected_build_configuration->ExcludeFiles); // Append trailing slash to the end of the path if it's not already there if(substr($path, -1) !== DIRECTORY_SEPARATOR) @@ -114,7 +134,8 @@ // Scan for components first. Console::out('Scanning for components... ', false); /** @var SplFileInfo $item */ - foreach($DirectoryScanner($source_path, true) as $item) + /** @noinspection PhpRedundantOptionalArgumentInspection */ + foreach($DirectoryScanner($source_path, True) as $item) { // Ignore directories, they're not important. :-) if(is_dir($item->getPathName())) @@ -144,7 +165,7 @@ // Ignore component files $DirectoryScanner->setExcludes(array_merge( - $selected_build_configuration->ExcludeFiles, ComponentFileExtensions::Php + $this->selected_build_configuration->ExcludeFiles, ComponentFileExtensions::Php )); Console::out('Scanning for resources... ', false); @@ -177,12 +198,11 @@ /** * Builds the package by parsing the AST contents of the components and resources * - * @param array $options * @param string $path * @return string * @throws BuildException */ - public function build(array $options, string $path): string + public function build(string $path): string { if($this->package == null) { @@ -195,14 +215,6 @@ $path .= DIRECTORY_SEPARATOR; } - $source_path = $path . $this->project->Build->SourcePath; - - // Append trailing slash to the end of the source path if it's not already there - if(substr($source_path, -1) !== DIRECTORY_SEPARATOR) - { - $source_path .= DIRECTORY_SEPARATOR; - } - // Runtime variables $components = []; $resources = []; @@ -220,12 +232,12 @@ // Process the components and attempt to create an AST representation of the source foreach($this->package->Components as $component) { - if(ncc::cliMode()) + if(ncc::cliMode() && $total_items > 5) { Console::inlineProgressBar($processed_items, $total_items); } - $content = file_get_contents(Functions::correctDirectorySeparator($source_path . $component->Name)); + $content = file_get_contents(Functions::correctDirectorySeparator($path . $component->Name)); $parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7); try @@ -235,29 +247,35 @@ if($encoded === false) { - $component->Flags[] = ComponentFlags::b64encoded; - $component->Data = Functions::byteEncode($content); + $component->DataType = ComponentDataType::b64encoded; + $component->Data = Base64::encode($content); + $component->Checksum = hash('sha1', $component->Data); } else { - $component->Flags[] = ComponentFlags::AST; - $component->Data = ZiProto::encode(json_decode($encoded)); + $component->DataType = ComponentDataType::AST; + $component->Data = json_decode($encoded, true); + $component->Checksum = null; } } catch(Error $e) { - $component->Flags[] = ComponentFlags::b64encoded; - $component->Data = Functions::byteEncode($content); + $component->DataType = ComponentDataType::b64encoded; + $component->Data = Base64::encode($content); + $component->Checksum = hash('sha1', $component->Data); unset($e); } - // Calculate the checksum - $component->Checksum = hash('sha1', $component->Data); - + $component->Name = str_replace($this->project->Build->SourcePath, (string)null, $component->Name); $components[] = $component; $processed_items += 1; } + if(ncc::cliMode() && $total_items > 5) + { + print(PHP_EOL); + } + // Update the components $this->package->Components = $components; } @@ -274,15 +292,17 @@ foreach($this->package->Resources as $resource) { - if(ncc::cliMode()) + if(ncc::cliMode() && $total_items > 5) { Console::inlineProgressBar($processed_items, $total_items); } // Get the data and - $resource->Data = file_get_contents(Functions::correctDirectorySeparator($source_path . $resource->Name)); - $resource->Data = Functions::byteEncode($resource->Data); - $resource->Checksum = hash('sha1', $resource->Checksum); + $resource->Data = file_get_contents(Functions::correctDirectorySeparator($path . $resource->Name)); + $resource->Data = Base64::encode($resource->Data); + $resource->Checksum = hash('sha1', $resource->Data); + $resource->Name = str_replace($this->project->Build->SourcePath, (string)null, $resource->Name); + $resources[] = $resource; } // Update the resources @@ -291,11 +311,40 @@ if(ncc::cliMode()) { + if($total_items > 5) + print(PHP_EOL); Console::out($this->package->Assembly->Package . ' compiled successfully'); } // Write the package to disk - file_put_contents(getcwd() . DIRECTORY_SEPARATOR . 'test.bin', ZiProto::encode($this->package->toArray(true))); - return getcwd() . DIRECTORY_SEPARATOR . 'test.bin'; + $FileSystem = new Filesystem(); + + if($FileSystem->exists($path . $this->selected_build_configuration->OutputPath)) + { + try + { + $FileSystem->remove($path . $this->selected_build_configuration->OutputPath); + } + catch(IOException $e) + { + throw new BuildException('Cannot delete directory \'' . $path . $this->selected_build_configuration->OutputPath . '\', ' . $e->getMessage(), $e); + } + } + + // Finally write the package to the disk + $FileSystem->mkdir($path . $this->selected_build_configuration->OutputPath); + $output_file = $path . $this->selected_build_configuration->OutputPath . DIRECTORY_SEPARATOR . $this->package->Assembly->Package . '.ncc'; + $FileSystem->touch($output_file); + + try + { + $this->package->save($output_file); + } + catch(Exception $e) + { + throw new BuildException('Cannot write to output file', $e); + } + + return $output_file; } } \ No newline at end of file diff --git a/src/ncc/Objects/Package.php b/src/ncc/Objects/Package.php index bb73978..78bf4dc 100644 --- a/src/ncc/Objects/Package.php +++ b/src/ncc/Objects/Package.php @@ -15,6 +15,7 @@ use ncc\Objects\ProjectConfiguration\Assembly; use ncc\Objects\ProjectConfiguration\Dependency; use ncc\Utilities\Functions; + use ncc\ZiProto\ZiProto; class Package { @@ -125,6 +126,18 @@ return true; } + /** + * Writes the package contents to disk + * + * @param string $output_path + * @return void + */ + public function save(string $output_path): void + { + $package_contents = $this->MagicBytes->toString() . ZiProto::encode($this->toArray(true)); + file_put_contents($output_path, $package_contents); + } + /** * Constructs an array representation of the object * @@ -148,12 +161,13 @@ foreach($this->Resources as $resource) $_resources[] = $resource->toArray($bytecode); + return [ - ($bytecode ? Functions::cbc('header') : 'header') => $this->Header->toArray($bytecode), - ($bytecode ? Functions::cbc('assembly') : 'assembly') => $this->Assembly->toArray($bytecode), + ($bytecode ? Functions::cbc('header') : 'header') => $this->Header?->toArray($bytecode), + ($bytecode ? Functions::cbc('assembly') : 'assembly') => $this->Assembly?->toArray($bytecode), ($bytecode ? Functions::cbc('dependencies') : 'dependencies') => $_dependencies, - ($bytecode ? Functions::cbc('main_execution_policy') : 'main_execution_policy') => $this->MainExecutionPolicy->toArray($bytecode), - ($bytecode ? Functions::cbc('installer') : 'installer') => $this->Installer->toArray($bytecode), + ($bytecode ? Functions::cbc('main_execution_policy') : 'main_execution_policy') => $this->MainExecutionPolicy?->toArray($bytecode), + ($bytecode ? Functions::cbc('installer') : 'installer') => $this->Installer?->toArray($bytecode), ($bytecode ? Functions::cbc('resources') : 'resources') => $_resources, ($bytecode ? Functions::cbc('components') : 'components') => $_components ]; diff --git a/src/ncc/Objects/ProjectConfiguration.php b/src/ncc/Objects/ProjectConfiguration.php index 0d68738..f2980b1 100644 --- a/src/ncc/Objects/ProjectConfiguration.php +++ b/src/ncc/Objects/ProjectConfiguration.php @@ -3,8 +3,14 @@ namespace ncc\Objects; use ncc\Exceptions\FileNotFoundException; + use ncc\Exceptions\InvalidConstantNameException; + use ncc\Exceptions\InvalidProjectBuildConfiguration; use ncc\Exceptions\InvalidProjectConfigurationException; + use ncc\Exceptions\InvalidPropertyValueException; use ncc\Exceptions\MalformedJsonException; + use ncc\Exceptions\RuntimeException; + use ncc\Exceptions\UnsupportedCompilerExtensionException; + use ncc\Exceptions\UnsupportedExtensionVersionException; use ncc\Objects\ProjectConfiguration\Assembly; use ncc\Objects\ProjectConfiguration\Build; use ncc\Objects\ProjectConfiguration\Project; @@ -53,12 +59,24 @@ * @param bool $throw_exception * @return bool * @throws InvalidProjectConfigurationException + * @throws InvalidPropertyValueException + * @throws RuntimeException + * @throws UnsupportedCompilerExtensionException + * @throws UnsupportedExtensionVersionException + * @throws InvalidProjectBuildConfiguration + * @throws InvalidConstantNameException */ public function validate(bool $throw_exception=True): bool { + if(!$this->Project->validate($throw_exception)) + return false; + if(!$this->Assembly->validate($throw_exception)) return false; + if(!$this->Build->validate($throw_exception)) + return false; + return true; } diff --git a/src/ncc/Objects/ProjectConfiguration/Assembly.php b/src/ncc/Objects/ProjectConfiguration/Assembly.php index e2b7e0f..f87c0cb 100644 --- a/src/ncc/Objects/ProjectConfiguration/Assembly.php +++ b/src/ncc/Objects/ProjectConfiguration/Assembly.php @@ -109,10 +109,10 @@ return false; } - if(strlen($this->Name) > 40) + if(strlen($this->Name) > 126) { if($throw_exception) - throw new InvalidProjectConfigurationException('The name cannot be larger than 40 characters', 'Assembly.Name'); + throw new InvalidProjectConfigurationException('The name cannot be larger than 126 characters', 'Assembly.Name'); return false; } @@ -133,26 +133,26 @@ return false; } - if(strlen($this->Product) > 64) + if(strlen($this->Product) > 256) { if($throw_exception) - throw new InvalidProjectConfigurationException('The company cannot be larger than 64 characters', 'Assembly.Product'); + throw new InvalidProjectConfigurationException('The company cannot be larger than 256 characters', 'Assembly.Product'); return false; } - if(strlen($this->Copyright) > 64) + if(strlen($this->Copyright) > 256) { if($throw_exception) - throw new InvalidProjectConfigurationException('The copyright cannot be larger than 64 characters', 'Assembly.Copyright'); + throw new InvalidProjectConfigurationException('The copyright cannot be larger than 256 characters', 'Assembly.Copyright'); return false; } - if(strlen($this->Trademark) > 64) + if(strlen($this->Trademark) > 256) { if($throw_exception) - throw new InvalidProjectConfigurationException('The trademark cannot be larger than 64 characters', 'Assembly.Trademark'); + throw new InvalidProjectConfigurationException('The trademark cannot be larger than 256 characters', 'Assembly.Trademark'); return false; } diff --git a/src/ncc/Objects/ProjectConfiguration/Build.php b/src/ncc/Objects/ProjectConfiguration/Build.php index c33af21..cf45987 100644 --- a/src/ncc/Objects/ProjectConfiguration/Build.php +++ b/src/ncc/Objects/ProjectConfiguration/Build.php @@ -5,8 +5,10 @@ namespace ncc\Objects\ProjectConfiguration; use ncc\Exceptions\BuildConfigurationNotFoundException; + use ncc\Exceptions\InvalidConstantNameException; use ncc\Exceptions\InvalidProjectBuildConfiguration; use ncc\Utilities\Functions; + use ncc\Utilities\Validate; /** * @author Zi Xing Narrakas @@ -87,11 +89,21 @@ * * @param bool $throw_exception * @return bool + * @throws InvalidConstantNameException * @throws InvalidProjectBuildConfiguration */ public function validate(bool $throw_exception=True): bool { - // TODO: Implement further validation logic + // TODO: Implement validation for Configurations, Dependencies and ExcludedFiles + + // Check the defined constants + foreach($this->DefineConstants as $name => $value) + { + if(!Validate::constantName($name)) + { + throw new InvalidConstantNameException('The name \'' . $name . '\' is not valid for a constant declaration, '); + } + } // Check for duplicate configuration names $build_configurations = []; diff --git a/src/ncc/Utilities/Console.php b/src/ncc/Utilities/Console.php index 01d8418..3f5b2a5 100644 --- a/src/ncc/Utilities/Console.php +++ b/src/ncc/Utilities/Console.php @@ -4,6 +4,7 @@ use Exception; use ncc\Abstracts\ConsoleColors; + use ncc\ncc; class Console { @@ -18,16 +19,16 @@ * @return void *@copyright Copyright (c) 2010, dealnews.com, Inc. All rights reserved. */ - public static function inlineProgressBar(int $value, int $total, int $size=38, array $options=[]) + public static function inlineProgressBar(int $value, int $total, int $size=38, array $options=[]): void { static $start_time; // if we go over our bound, just ignore it - if($value > $total) return; + if($value > $total) + return; if(empty($start_time)) $start_time=time(); $now = time(); - $perc=(double)($value/$total); $bar=floor($perc*$size); @@ -45,6 +46,9 @@ $status_bar.=" ] $disp% $value/$total"; + if($value == 0) + return; + $rate = ($now-$start_time)/$value; $left = $total - $value; $eta = round($rate * $left, 2); @@ -75,8 +79,11 @@ * @param bool $newline * @return void */ - public static function out(string $message, bool $newline=true) + public static function out(string $message, bool $newline=true): void { + if(!ncc::cliMode()) + return; + if($newline) { print($message . PHP_EOL); @@ -111,8 +118,11 @@ * @param bool $newline * @return void */ - public static function outWarning(string $message, bool $newline=true) + public static function outWarning(string $message, bool $newline=true): void { + if(!ncc::cliMode()) + return; + self::out(self::formatColor('Warning: ', ConsoleColors::Yellow) . $message, $newline); } @@ -124,8 +134,11 @@ * @param int|null $exit_code * @return void */ - public static function outError(string $message, bool $newline=true, ?int $exit_code=null) + public static function outError(string $message, bool $newline=true, ?int $exit_code=null): void { + if(!ncc::cliMode()) + return; + self::out(self::formatColor(ConsoleColors::Red, 'Error: ') . $message, $newline); if($exit_code !== null) @@ -142,8 +155,11 @@ * @param int|null $exit_code * @return void */ - public static function outException(string $message, Exception $e, ?int $exit_code=null) + public static function outException(string $message, Exception $e, ?int $exit_code=null): void { + if(!ncc::cliMode()) + return; + if(strlen($message) > 0) { self::out(self::formatColor('Error: ' . $message, ConsoleColors::Red)); @@ -163,8 +179,11 @@ * @param Exception $e * @return void */ - private static function outExceptionDetails(Exception $e) + private static function outExceptionDetails(Exception $e): void { + if(!ncc::cliMode()) + return; + $trace_header = self::formatColor($e->getFile() . ':' . $e->getLine(), ConsoleColors::Magenta); $trace_error = self::formatColor('error: ', ConsoleColors::Red); self::out($trace_header . ' ' . $trace_error . $e->getMessage()); diff --git a/src/ncc/Utilities/Functions.php b/src/ncc/Utilities/Functions.php index bb812b8..e0b74d9 100644 --- a/src/ncc/Utilities/Functions.php +++ b/src/ncc/Utilities/Functions.php @@ -5,9 +5,6 @@ use ncc\Exceptions\FileNotFoundException; use ncc\Exceptions\MalformedJsonException; use ncc\Objects\CliHelpSection; - use function chr; - use function is_int; - use function is_string; /** * @author Zi Xing Narrakas diff --git a/src/ncc/Utilities/PathFinder.php b/src/ncc/Utilities/PathFinder.php index 16fbbad..373c0fa 100644 --- a/src/ncc/Utilities/PathFinder.php +++ b/src/ncc/Utilities/PathFinder.php @@ -3,7 +3,6 @@ namespace ncc\Utilities; use ncc\Abstracts\Scopes; - use ncc\Exceptions\AccessDeniedException; use ncc\Exceptions\InvalidScopeException; class PathFinder