diff --git a/CHANGELOG.md b/CHANGELOG.md index 245eab8..19529e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -98,6 +98,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Implemented interface `BytecodeObjectInterface` into `\ncc\Objects\ProjectConfiguration > Dependecy` - Implemented interface `BytecodeObjectInterface` into `\ncc\Objects\ProjectConfiguration > Compiler` - Implemented interface `BytecodeObjectInterface` into `\ncc\Objects\ProjectConfiguration > Build` + - Implemented interface `BytecodeObjectInterface` into `\ncc\Objects\ProjectConfiguration > Assembly` + - Implemented interface `BytecodeObjectInterface` into `\ncc\Objects\ProjectConfiguration\UpdateSource > Repository` + - Implemented interface `BytecodeObjectInterface` into `\ncc\Objects\ProjectConfiguration\ExecutionPolicy > Execute` + - Implemented interface `BytecodeObjectInterface` into `\ncc\Objects\ProjectConfiguration\ExecutionPolicy > ExitHandle` + - Implemented interface `BytecodeObjectInterface` into `\ncc\Objects\ProjectConfiguration\ExecutionPolicy > ExitHandlers` + - Implemented interface `BytecodeObjectInterface` into `\ncc\Objects\ProjectConfiguration\Build > BuildConfiguration` ### Removed - Removed `FileNotFoundException` and `DirectoryNotFoundException` from `\ncc\Exceptions` diff --git a/src/ncc/CLI/Management/PackageManagerMenu.php b/src/ncc/CLI/Management/PackageManagerMenu.php index 6c2f57a..37d00c1 100644 --- a/src/ncc/CLI/Management/PackageManagerMenu.php +++ b/src/ncc/CLI/Management/PackageManagerMenu.php @@ -448,49 +448,49 @@ Console::out('Package installation details' . PHP_EOL); - if(!is_null($package->assembly->UUID)) + if(!is_null($package->assembly->uuid)) { - Console::out(' UUID: ' . Console::formatColor($package->assembly->UUID, ConsoleColors::LIGHT_GREEN)); + Console::out(' UUID: ' . Console::formatColor($package->assembly->uuid, ConsoleColors::LIGHT_GREEN)); } - if(!is_null($package->assembly->Package)) + if(!is_null($package->assembly->package)) { - Console::out(' Package: ' . Console::formatColor($package->assembly->Package, ConsoleColors::LIGHT_GREEN)); + Console::out(' Package: ' . Console::formatColor($package->assembly->package, ConsoleColors::LIGHT_GREEN)); } - if(!is_null($package->assembly->Name)) + if(!is_null($package->assembly->name)) { - Console::out(' Name: ' . Console::formatColor($package->assembly->Name, ConsoleColors::LIGHT_GREEN)); + Console::out(' Name: ' . Console::formatColor($package->assembly->name, ConsoleColors::LIGHT_GREEN)); } - if(!is_null($package->assembly->Version)) + if(!is_null($package->assembly->version)) { - Console::out(' Version: ' . Console::formatColor($package->assembly->Version, ConsoleColors::LIGHT_GREEN)); + Console::out(' Version: ' . Console::formatColor($package->assembly->version, ConsoleColors::LIGHT_GREEN)); } - if(!is_null($package->assembly->Description)) + if(!is_null($package->assembly->description)) { - Console::out(' Description: ' . Console::formatColor($package->assembly->Description, ConsoleColors::LIGHT_GREEN)); + Console::out(' Description: ' . Console::formatColor($package->assembly->description, ConsoleColors::LIGHT_GREEN)); } - if(!is_null($package->assembly->Product)) + if(!is_null($package->assembly->product)) { - Console::out(' Product: ' . Console::formatColor($package->assembly->Product, ConsoleColors::LIGHT_GREEN)); + Console::out(' Product: ' . Console::formatColor($package->assembly->product, ConsoleColors::LIGHT_GREEN)); } - if(!is_null($package->assembly->Company)) + if(!is_null($package->assembly->company)) { - Console::out(' Company: ' . Console::formatColor($package->assembly->Company, ConsoleColors::LIGHT_GREEN)); + Console::out(' Company: ' . Console::formatColor($package->assembly->company, ConsoleColors::LIGHT_GREEN)); } - if(!is_null($package->assembly->Copyright)) + if(!is_null($package->assembly->copyright)) { - Console::out(' Copyright: ' . Console::formatColor($package->assembly->Copyright, ConsoleColors::LIGHT_GREEN)); + Console::out(' Copyright: ' . Console::formatColor($package->assembly->copyright, ConsoleColors::LIGHT_GREEN)); } - if(!is_null($package->assembly->Trademark)) + if(!is_null($package->assembly->trademark)) { - Console::out(' Trademark: ' . Console::formatColor($package->assembly->Trademark, ConsoleColors::LIGHT_GREEN)); + Console::out(' Trademark: ' . Console::formatColor($package->assembly->trademark, ConsoleColors::LIGHT_GREEN)); } Console::out((string)null); @@ -570,7 +570,7 @@ if(!$user_confirmation) { - $user_confirmation = Console::getBooleanInput(sprintf('Do you want to install %s', $package->assembly->Package)); + $user_confirmation = Console::getBooleanInput(sprintf('Do you want to install %s', $package->assembly->package)); } if($user_confirmation) @@ -578,7 +578,7 @@ try { $package_manager->install($path, $credential, $installer_options); - Console::out(sprintf('Package %s installed successfully', $package->assembly->Package)); + Console::out(sprintf('Package %s installed successfully', $package->assembly->package)); } catch(Exception $e) { diff --git a/src/ncc/Classes/BashExtension/BashRunner.php b/src/ncc/Classes/BashExtension/BashRunner.php index f744564..ff474d3 100644 --- a/src/ncc/Classes/BashExtension/BashRunner.php +++ b/src/ncc/Classes/BashExtension/BashRunner.php @@ -46,7 +46,7 @@ namespace ncc\Classes\BashExtension; $execution_unit->execution_policy = $policy; $execution_unit->Data = IO::fread($path); - $policy->execute->Target = null; + $policy->execute->target = null; return $execution_unit; } diff --git a/src/ncc/Classes/ComposerExtension/ComposerSourceBuiltin.php b/src/ncc/Classes/ComposerExtension/ComposerSourceBuiltin.php index 4aa24bd..061bb9c 100644 --- a/src/ncc/Classes/ComposerExtension/ComposerSourceBuiltin.php +++ b/src/ncc/Classes/ComposerExtension/ComposerSourceBuiltin.php @@ -259,10 +259,10 @@ namespace ncc\Classes\ComposerExtension; $built_package = $project_manager->build(); // Copy the project to the build directory - $out_path = $base_dir . DIRECTORY_SEPARATOR . 'build' . DIRECTORY_SEPARATOR . sprintf('%s.ncc', $project_configuration->assembly->Package); + $out_path = $base_dir . DIRECTORY_SEPARATOR . 'build' . DIRECTORY_SEPARATOR . sprintf('%s.ncc', $project_configuration->assembly->package); $filesystem->copy($built_package, $out_path); $filesystem->remove($built_package); - $built_packages[$project_configuration->assembly->Package] = $out_path; + $built_packages[$project_configuration->assembly->package] = $out_path; } return $built_packages; @@ -340,27 +340,27 @@ namespace ncc\Classes\ComposerExtension; if (isset($composer_package->Name)) { - $project_configuration->assembly->Name = $composer_package->Name; + $project_configuration->assembly->name = $composer_package->Name; } if (isset($composer_package->Description)) { - $project_configuration->assembly->Description = $composer_package->Description; + $project_configuration->assembly->description = $composer_package->Description; } if(isset($version_map[$composer_package->Name])) { - $project_configuration->assembly->Version = self::versionMap($composer_package->Name, $version_map); + $project_configuration->assembly->version = self::versionMap($composer_package->Name, $version_map); } - if($project_configuration->assembly->Version === null || $project_configuration->assembly->Version === '') + if($project_configuration->assembly->version === null || $project_configuration->assembly->version === '') { - $project_configuration->assembly->Version = '1.0.0'; + $project_configuration->assembly->version = '1.0.0'; } - $project_configuration->assembly->UUID = Uuid::v1()->toRfc4122(); - $project_configuration->assembly->Package = self::toPackageName($composer_package->Name); + $project_configuration->assembly->uuid = Uuid::v1()->toRfc4122(); + $project_configuration->assembly->package = self::toPackageName($composer_package->Name); // Add the update source $project_configuration->project->update_source = new ProjectConfiguration\UpdateSource(); @@ -391,8 +391,8 @@ namespace ncc\Classes\ComposerExtension; // Create a build configuration $build_configuration = new ProjectConfiguration\Build\BuildConfiguration(); - $build_configuration->Name = 'default'; - $build_configuration->OutputPath = 'build'; + $build_configuration->name = 'default'; + $build_configuration->output_path = 'build'; // Apply the final properties $project_configuration->build->build_configurations[] = $build_configuration; diff --git a/src/ncc/Classes/LuaExtension/LuaRunner.php b/src/ncc/Classes/LuaExtension/LuaRunner.php index 1ae7d62..c1069dc 100644 --- a/src/ncc/Classes/LuaExtension/LuaRunner.php +++ b/src/ncc/Classes/LuaExtension/LuaRunner.php @@ -36,7 +36,7 @@ namespace ncc\Classes\LuaExtension; public static function processUnit(string $path, ExecutionPolicy $policy): ExecutionUnit { $execution_unit = new ExecutionUnit(); - $policy->execute->Target = null; + $policy->execute->target = null; $execution_unit->execution_policy = $policy; $execution_unit->Data = IO::fread($path); diff --git a/src/ncc/Classes/NccExtension/ConstantCompiler.php b/src/ncc/Classes/NccExtension/ConstantCompiler.php index 627561a..0adc9f8 100644 --- a/src/ncc/Classes/NccExtension/ConstantCompiler.php +++ b/src/ncc/Classes/NccExtension/ConstantCompiler.php @@ -46,49 +46,49 @@ namespace ncc\Classes\NccExtension; return null; } - if($assembly->Name !== null) + if($assembly->name !== null) { - $input = str_replace(AssemblyConstants::ASSEMBLY_NAME, $assembly->Name, $input); + $input = str_replace(AssemblyConstants::ASSEMBLY_NAME, $assembly->name, $input); } - if($assembly->Package !== null) + if($assembly->package !== null) { - $input = str_replace(AssemblyConstants::ASSEMBLY_PACKAGE, $assembly->Package, $input); + $input = str_replace(AssemblyConstants::ASSEMBLY_PACKAGE, $assembly->package, $input); } - if($assembly->Description !== null) + if($assembly->description !== null) { - $input = str_replace(AssemblyConstants::ASSEMBLY_DESCRIPTION, $assembly->Description, $input); + $input = str_replace(AssemblyConstants::ASSEMBLY_DESCRIPTION, $assembly->description, $input); } - if($assembly->Company !== null) + if($assembly->company !== null) { - $input = str_replace(AssemblyConstants::ASSEMBLY_COMPANY, $assembly->Company, $input); + $input = str_replace(AssemblyConstants::ASSEMBLY_COMPANY, $assembly->company, $input); } - if($assembly->Product !== null) + if($assembly->product !== null) { - $input = str_replace(AssemblyConstants::ASSEMBLY_PRODUCT, $assembly->Product, $input); + $input = str_replace(AssemblyConstants::ASSEMBLY_PRODUCT, $assembly->product, $input); } - if($assembly->Copyright !== null) + if($assembly->copyright !== null) { - $input = str_replace(AssemblyConstants::ASSEMBLY_COPYRIGHT, $assembly->Copyright, $input); + $input = str_replace(AssemblyConstants::ASSEMBLY_COPYRIGHT, $assembly->copyright, $input); } - if($assembly->Trademark !== null) + if($assembly->trademark !== null) { - $input =str_replace(AssemblyConstants::ASSEMBLY_TRADEMARK, $assembly->Trademark, $input); + $input =str_replace(AssemblyConstants::ASSEMBLY_TRADEMARK, $assembly->trademark, $input); } - if($assembly->Version !== null) + if($assembly->version !== null) { - $input = str_replace(AssemblyConstants::ASSEMBLY_VERSION, $assembly->Version, $input); + $input = str_replace(AssemblyConstants::ASSEMBLY_VERSION, $assembly->version, $input); } - if($assembly->UUID !== null) + if($assembly->uuid !== null) { - $input = str_replace(AssemblyConstants::ASSEMBLY_UID, $assembly->UUID, $input); + $input = str_replace(AssemblyConstants::ASSEMBLY_UID, $assembly->uuid, $input); } return $input; diff --git a/src/ncc/Classes/NccExtension/PackageCompiler.php b/src/ncc/Classes/NccExtension/PackageCompiler.php index b914fae..5ae5168 100644 --- a/src/ncc/Classes/NccExtension/PackageCompiler.php +++ b/src/ncc/Classes/NccExtension/PackageCompiler.php @@ -96,8 +96,8 @@ throw new UnsupportedCompilerExtensionException('The compiler extension \'' . $configuration->project->compiler->extension . '\' is not supported'); } - $build_configuration = $configuration->build->getBuildConfiguration($build_configuration)->Name; - Console::out(sprintf('Building %s=%s', $configuration->assembly->Package, $configuration->assembly->Version)); + $build_configuration = $configuration->build->getBuildConfiguration($build_configuration)->name; + Console::out(sprintf('Building %s=%s', $configuration->assembly->package, $configuration->assembly->version)); $Compiler->prepare($build_configuration); $Compiler->build(); @@ -128,7 +128,7 @@ elseif($project_type->ProjectType === ProjectType::NCC) { $project_manager = new ProjectManager($project_type->ProjectPath); - $project_manager->getProjectConfiguration()->assembly->Version = $version; + $project_manager->getProjectConfiguration()->assembly->version = $version; $project_path = $project_manager->build(); } else @@ -139,7 +139,7 @@ if($version !== null) { $package = Package::load($project_path); - $package->assembly->Version = Functions::convertToSemVer($version); + $package->assembly->version = Functions::convertToSemVer($version); $package->save($project_path); } @@ -186,7 +186,7 @@ Console::inlineProgressBar($processed_items, $total_items); } - $unit_path = Functions::correctDirectorySeparator($path . $policy->execute->Target); + $unit_path = Functions::correctDirectorySeparator($path . $policy->execute->target); $execution_units[] = Functions::compileRunner($unit_path, $policy); } @@ -216,15 +216,15 @@ // Write the package to disk $FileSystem = new Filesystem(); $BuildConfiguration = $configuration->build->getBuildConfiguration($build_configuration); - if(!$FileSystem->exists($path . $BuildConfiguration->OutputPath)) + if(!$FileSystem->exists($path . $BuildConfiguration->output_path)) { - Console::outDebug(sprintf('creating output directory %s', $path . $BuildConfiguration->OutputPath)); - $FileSystem->mkdir($path . $BuildConfiguration->OutputPath); + Console::outDebug(sprintf('creating output directory %s', $path . $BuildConfiguration->output_path)); + $FileSystem->mkdir($path . $BuildConfiguration->output_path); } // Finally write the package to the disk - $FileSystem->mkdir($path . $BuildConfiguration->OutputPath); - $output_file = $path . $BuildConfiguration->OutputPath . DIRECTORY_SEPARATOR . $package->assembly->Package . '.ncc'; + $FileSystem->mkdir($path . $BuildConfiguration->output_path); + $output_file = $path . $BuildConfiguration->output_path . DIRECTORY_SEPARATOR . $package->assembly->package . '.ncc'; if($FileSystem->exists($output_file)) { Console::outDebug(sprintf('removing existing package %s', $output_file)); @@ -327,42 +327,42 @@ if($unit->execution_policy->exit_handlers !== null) { - if($unit->execution_policy->exit_handlers->Success !== null) + if($unit->execution_policy->exit_handlers->success !== null) { - $unit->execution_policy->exit_handlers->Success->Message = self::compileConstants($unit->execution_policy->exit_handlers->Success->Message, $refs); + $unit->execution_policy->exit_handlers->success->message = self::compileConstants($unit->execution_policy->exit_handlers->success->message, $refs); } - if($unit->execution_policy->exit_handlers->Error !== null) + if($unit->execution_policy->exit_handlers->error !== null) { - $unit->execution_policy->exit_handlers->Error->Message = self::compileConstants($unit->execution_policy->exit_handlers->Error->Message, $refs); + $unit->execution_policy->exit_handlers->error->message = self::compileConstants($unit->execution_policy->exit_handlers->error->message, $refs); } - if($unit->execution_policy->exit_handlers->Warning !== null) + if($unit->execution_policy->exit_handlers->warning !== null) { - $unit->execution_policy->exit_handlers->Warning->Message = self::compileConstants($unit->execution_policy->exit_handlers->Warning->Message, $refs); + $unit->execution_policy->exit_handlers->warning->message = self::compileConstants($unit->execution_policy->exit_handlers->warning->message, $refs); } } if($unit->execution_policy->execute !== null) { - if($unit->execution_policy->execute->Target !== null) + if($unit->execution_policy->execute->target !== null) { - $unit->execution_policy->execute->Target = self::compileConstants($unit->execution_policy->execute->Target, $refs); + $unit->execution_policy->execute->target = self::compileConstants($unit->execution_policy->execute->target, $refs); } - if($unit->execution_policy->execute->WorkingDirectory !== null) + if($unit->execution_policy->execute->working_directory !== null) { - $unit->execution_policy->execute->WorkingDirectory = self::compileConstants($unit->execution_policy->execute->WorkingDirectory, $refs); + $unit->execution_policy->execute->working_directory = self::compileConstants($unit->execution_policy->execute->working_directory, $refs); } - if($unit->execution_policy->execute->Options !== null && count($unit->execution_policy->execute->Options) > 0) + if($unit->execution_policy->execute->options !== null && count($unit->execution_policy->execute->options) > 0) { $options = []; - foreach($unit->execution_policy->execute->Options as $key=> $value) + foreach($unit->execution_policy->execute->options as $key=> $value) { $options[self::compileConstants($key, $refs)] = self::compileConstants($value, $refs); } - $unit->execution_policy->execute->Options = $options; + $unit->execution_policy->execute->options = $options; } } diff --git a/src/ncc/Classes/PerlExtension/PerlRunner.php b/src/ncc/Classes/PerlExtension/PerlRunner.php index dd722ca..5269c86 100644 --- a/src/ncc/Classes/PerlExtension/PerlRunner.php +++ b/src/ncc/Classes/PerlExtension/PerlRunner.php @@ -45,7 +45,7 @@ public static function processUnit(string $path, ExecutionPolicy $policy): ExecutionUnit { $execution_unit = new ExecutionUnit(); - $policy->execute->Target = null; + $policy->execute->target = null; if(!file_exists($path) && !is_file($path)) { diff --git a/src/ncc/Classes/PhpExtension/PhpCompiler.php b/src/ncc/Classes/PhpExtension/PhpCompiler.php index 2b29881..ec87bfd 100644 --- a/src/ncc/Classes/PhpExtension/PhpCompiler.php +++ b/src/ncc/Classes/PhpExtension/PhpCompiler.php @@ -121,7 +121,7 @@ // Global constants are overridden $this->package->header->RuntimeConstants = []; $this->package->header->RuntimeConstants = array_merge( - ($selected_build_configuration->DefineConstants ?? []), + ($selected_build_configuration->define_constants ?? []), ($this->project->build->define_constants ?? []), ($this->package->header->RuntimeConstants ?? []) ); @@ -153,9 +153,9 @@ // Include file components that can be compiled $DirectoryScanner->setIncludes(ComponentFileExtensions::PHP); - if($selected_build_configuration->ExcludeFiles !== null && count($selected_build_configuration->ExcludeFiles) > 0) + if($selected_build_configuration->exclude_files !== null && count($selected_build_configuration->exclude_files) > 0) { - $DirectoryScanner->setExcludes($selected_build_configuration->ExcludeFiles); + $DirectoryScanner->setExcludes($selected_build_configuration->exclude_files); } $source_path = $this->path . $this->project->build->source_path; @@ -196,9 +196,9 @@ $DirectoryScanner->setIncludes(); // Ignore component files - if($selected_build_configuration->ExcludeFiles !== null && count($selected_build_configuration->ExcludeFiles) > 0) + if($selected_build_configuration->exclude_files !== null && count($selected_build_configuration->exclude_files) > 0) { - $DirectoryScanner->setExcludes(array_merge($selected_build_configuration->ExcludeFiles, ComponentFileExtensions::PHP)); + $DirectoryScanner->setExcludes(array_merge($selected_build_configuration->exclude_files, ComponentFileExtensions::PHP)); } else { @@ -243,9 +243,9 @@ $selected_dependencies = array_merge($selected_dependencies, $this->project->build->dependencies); } - if($selected_build_configuration->Dependencies !== null && count($selected_build_configuration->Dependencies) > 0) + if($selected_build_configuration->dependencies !== null && count($selected_build_configuration->dependencies) > 0) { - $selected_dependencies = array_merge($selected_dependencies, $selected_build_configuration->Dependencies); + $selected_dependencies = array_merge($selected_dependencies, $selected_build_configuration->dependencies); } // Process the dependencies @@ -254,7 +254,7 @@ $package_lock_manager = new PackageLockManager(); $filesystem = new Filesystem(); - $lib_path = $selected_build_configuration->OutputPath . DIRECTORY_SEPARATOR . 'libs'; + $lib_path = $selected_build_configuration->output_path . DIRECTORY_SEPARATOR . 'libs'; if($filesystem->exists($lib_path)) { $filesystem->remove($lib_path); diff --git a/src/ncc/Classes/PhpExtension/PhpRunner.php b/src/ncc/Classes/PhpExtension/PhpRunner.php index a8217b5..2e184df 100644 --- a/src/ncc/Classes/PhpExtension/PhpRunner.php +++ b/src/ncc/Classes/PhpExtension/PhpRunner.php @@ -48,7 +48,7 @@ throw new PathNotFoundException($path); } - $policy->execute->Target = null; + $policy->execute->target = null; $execution_unit->execution_policy = $policy; $execution_unit->Data = IO::fread($path); diff --git a/src/ncc/Classes/PhpExtension/PhpRuntime.php b/src/ncc/Classes/PhpExtension/PhpRuntime.php index 74b7e53..ca95f7d 100644 --- a/src/ncc/Classes/PhpExtension/PhpRuntime.php +++ b/src/ncc/Classes/PhpExtension/PhpRuntime.php @@ -83,15 +83,15 @@ namespace ncc\Classes\PhpExtension; try { - Constants::register($assembly->Package, $name, $value, true); + Constants::register($assembly->package, $name, $value, true); } catch (ConstantReadonlyException $e) { - trigger_error('Constant \'' . $name . '\' is readonly (' . $assembly->Package . ')', E_USER_WARNING); + trigger_error('Constant \'' . $name . '\' is readonly (' . $assembly->package . ')', E_USER_WARNING); } catch (InvalidConstantNameException $e) { - throw new ImportException('Invalid constant name \'' . $name . '\' (' . $assembly->Package . ')', $e); + throw new ImportException('Invalid constant name \'' . $name . '\' (' . $assembly->package . ')', $e); } } } diff --git a/src/ncc/Classes/PythonExtension/Python2Runner.php b/src/ncc/Classes/PythonExtension/Python2Runner.php index 4c88139..ab85c4e 100644 --- a/src/ncc/Classes/PythonExtension/Python2Runner.php +++ b/src/ncc/Classes/PythonExtension/Python2Runner.php @@ -51,7 +51,7 @@ throw new PathNotFoundException($path); } - $policy->execute->Target = null; + $policy->execute->target = null; $execution_unit->execution_policy = $policy; $execution_unit->Data = IO::fread($path); diff --git a/src/ncc/Classes/PythonExtension/Python3Runner.php b/src/ncc/Classes/PythonExtension/Python3Runner.php index c8f8fa4..03e8b82 100644 --- a/src/ncc/Classes/PythonExtension/Python3Runner.php +++ b/src/ncc/Classes/PythonExtension/Python3Runner.php @@ -51,7 +51,7 @@ throw new PathNotFoundException($path); } - $policy->execute->Target = null; + $policy->execute->target = null; $execution_unit->execution_policy = $policy; $execution_unit->Data = IO::fread($path); diff --git a/src/ncc/Classes/PythonExtension/PythonRunner.php b/src/ncc/Classes/PythonExtension/PythonRunner.php index b6f381e..c37b044 100644 --- a/src/ncc/Classes/PythonExtension/PythonRunner.php +++ b/src/ncc/Classes/PythonExtension/PythonRunner.php @@ -51,7 +51,7 @@ throw new PathNotFoundException($path); } - $policy->execute->Target = null; + $policy->execute->target = null; $execution_unit->execution_policy = $policy; $execution_unit->Data = IO::fread($path); diff --git a/src/ncc/Managers/ExecutionPointerManager.php b/src/ncc/Managers/ExecutionPointerManager.php index 3ce7612..ab0c9e3 100644 --- a/src/ncc/Managers/ExecutionPointerManager.php +++ b/src/ncc/Managers/ExecutionPointerManager.php @@ -396,11 +396,11 @@ Console::outDebug(sprintf('pass_thru_args=%s', implode(' ', $args))); // Handle the arguments - if($unit->execution_policy->execute->Options !== null && count($unit->execution_policy->execute->Options) > 0) + if($unit->execution_policy->execute->options !== null && count($unit->execution_policy->execute->options) > 0) { - $args = array_merge($args, $unit->execution_policy->execute->Options); + $args = array_merge($args, $unit->execution_policy->execute->options); - foreach($unit->execution_policy->execute->Options as $option) + foreach($unit->execution_policy->execute->options as $option) { $args[] = ConstantCompiler::compileRuntimeConstants($option); } @@ -410,14 +410,14 @@ [PathFinder::findRunner(strtolower($unit->execution_policy->runner)), $unit->file_pointer], $args) ); - if($unit->execution_policy->execute->WorkingDirectory !== null) + if($unit->execution_policy->execute->working_directory !== null) { - $process->setWorkingDirectory(ConstantCompiler::compileRuntimeConstants($unit->execution_policy->execute->WorkingDirectory)); + $process->setWorkingDirectory(ConstantCompiler::compileRuntimeConstants($unit->execution_policy->execute->working_directory)); } - if($unit->execution_policy->execute->Timeout !== null) + if($unit->execution_policy->execute->timeout !== null) { - $process->setTimeout((float)$unit->execution_policy->execute->Timeout); + $process->setTimeout((float)$unit->execution_policy->execute->timeout); } else { @@ -427,12 +427,12 @@ try { - if($unit->execution_policy->execute->Silent) + if($unit->execution_policy->execute->silent) { $process->disableOutput(); $process->setTty(false); } - elseif($unit->execution_policy->execute->Tty) + elseif($unit->execution_policy->execute->tty) { $process->enableOutput(); $process->setTty(true); @@ -460,8 +460,8 @@ Console::outDebug(sprintf('working_directory=%s', $process->getWorkingDirectory())); Console::outDebug(sprintf('timeout=%s', (int)$process->getTimeout())); - Console::outDebug(sprintf('silent=%s', ($unit->execution_policy->execute->Silent ? 'true' : 'false'))); - Console::outDebug(sprintf('tty=%s', ($unit->execution_policy->execute->Tty ? 'true' : 'false'))); + Console::outDebug(sprintf('silent=%s', ($unit->execution_policy->execute->silent ? 'true' : 'false'))); + Console::outDebug(sprintf('tty=%s', ($unit->execution_policy->execute->tty ? 'true' : 'false'))); Console::outDebug(sprintf('options=%s', implode(' ', $args))); Console::outDebug(sprintf('cmd=%s', $process->getCommandLine())); @@ -481,9 +481,9 @@ } catch(Exception $e) { - if($unit->execution_policy->exit_handlers !== null && $unit->execution_policy->exit_handlers->Error !== null) + if($unit->execution_policy->exit_handlers !== null && $unit->execution_policy->exit_handlers->error !== null) { - $this->handleExit($package, $version, $unit->execution_policy->exit_handlers->Error); + $this->handleExit($package, $version, $unit->execution_policy->exit_handlers->error); } Console::outException(sprintf('An error occurred while executing the unit \'%s\' for \'%s\' (exit code %s)', $unit->execution_policy->name, $package, $process->getExitCode()), $e); @@ -495,19 +495,19 @@ if($unit->execution_policy->exit_handlers !== null) { - if($unit->execution_policy->exit_handlers->Success !== null && $process->isSuccessful()) + if($unit->execution_policy->exit_handlers->success !== null && $process->isSuccessful()) { - $this->handleExit($package, $version, $unit->execution_policy->exit_handlers->Success); + $this->handleExit($package, $version, $unit->execution_policy->exit_handlers->success); } - elseif($unit->execution_policy->exit_handlers->Error !== null && $process->isSuccessful()) + elseif($unit->execution_policy->exit_handlers->error !== null && $process->isSuccessful()) { - $this->handleExit($package, $version, $unit->execution_policy->exit_handlers->Error); + $this->handleExit($package, $version, $unit->execution_policy->exit_handlers->error); } else { - $this->handleExit($package, $version, $unit->execution_policy->exit_handlers->Success, $process); - $this->handleExit($package, $version, $unit->execution_policy->exit_handlers->Warning, $process); - $this->handleExit($package, $version, $unit->execution_policy->exit_handlers->Error, $process); + $this->handleExit($package, $version, $unit->execution_policy->exit_handlers->success, $process); + $this->handleExit($package, $version, $unit->execution_policy->exit_handlers->warning, $process); + $this->handleExit($package, $version, $unit->execution_policy->exit_handlers->error, $process); } } @@ -533,26 +533,26 @@ if($unit === null) { - throw new NoAvailableUnitsException(sprintf('No execution unit named \'%s\' is available for package \'%s\'', $unit_name, $package->assembly->Package)); + throw new NoAvailableUnitsException(sprintf('No execution unit named \'%s\' is available for package \'%s\'', $unit_name, $package->assembly->package)); } // Get the required units $required_units = []; if($unit->execution_policy->exit_handlers !== null) { - $required_unit = $unit->execution_policy?->exit_handlers?->Success?->Run; + $required_unit = $unit->execution_policy?->exit_handlers?->success?->run; if($required_unit !== null) { $required_units[] = $required_unit; } - $required_unit = $unit->execution_policy?->exit_handlers?->Warning?->Run; + $required_unit = $unit->execution_policy?->exit_handlers?->warning?->run; if($required_unit !== null) { $required_units[] = $required_unit; } - $required_unit = $unit->execution_policy?->exit_handlers?->Error?->Run; + $required_unit = $unit->execution_policy?->exit_handlers?->error?->run; if($required_unit !== null) { $required_units = $required_unit; @@ -560,13 +560,13 @@ } // Install the units temporarily - $this->addUnit($package->assembly->Package, $package->assembly->Version, $unit, true); + $this->addUnit($package->assembly->package, $package->assembly->version, $unit, true); foreach($required_units as $r_unit) { - $this->addUnit($package->assembly->Package, $package->assembly->Version, $r_unit, true); + $this->addUnit($package->assembly->package, $package->assembly->version, $r_unit, true); } - $this->executeUnit($package->assembly->Package, $package->assembly->Version, $unit_name); + $this->executeUnit($package->assembly->package, $package->assembly->version, $unit_name); $this->cleanTemporaryUnits(); } @@ -588,28 +588,28 @@ */ public function handleExit(string $package, string $version, ExitHandle $exit_handler, ?Process $process=null): bool { - if($exit_handler->Message !== null) + if($exit_handler->message !== null) { - Console::out($exit_handler->Message); + Console::out($exit_handler->message); } - if($process !== null && !$exit_handler->EndProcess) + if($process !== null && !$exit_handler->end_process) { - if($exit_handler->ExitCode !== $process->getExitCode()) + if($exit_handler->exit_code !== $process->getExitCode()) { return false; } } - elseif($exit_handler->EndProcess) + elseif($exit_handler->end_process) { Console::outDebug(sprintf('exit_code=%s', $process->getExitCode())); - exit($exit_handler->ExitCode); + exit($exit_handler->exit_code); } - if($exit_handler->Run !== null) + if($exit_handler->run !== null) { - Console::outVerbose('Running unit \'' . $exit_handler->Run . '\''); - $this->executeUnit($package, $version, $exit_handler->Run); + Console::outVerbose('Running unit \'' . $exit_handler->run . '\''); + $this->executeUnit($package, $version, $exit_handler->run); } return true; diff --git a/src/ncc/Managers/PackageManager.php b/src/ncc/Managers/PackageManager.php index c40cdc3..90f63e5 100644 --- a/src/ncc/Managers/PackageManager.php +++ b/src/ncc/Managers/PackageManager.php @@ -137,14 +137,14 @@ $package = Package::load($package_path); - if(RuntimeCache::get(sprintf('installed.%s=%s', $package->assembly->Package, $package->assembly->Version))) + if(RuntimeCache::get(sprintf('installed.%s=%s', $package->assembly->package, $package->assembly->version))) { - Console::outDebug(sprintf('skipping installation of %s=%s, already processed', $package->assembly->Package, $package->assembly->Version)); - return $package->assembly->Package; + Console::outDebug(sprintf('skipping installation of %s=%s, already processed', $package->assembly->package, $package->assembly->version)); + return $package->assembly->package; } $extension = $package->header->CompilerExtension->extension; - $installation_paths = new InstallationPaths($this->packages_path . DIRECTORY_SEPARATOR . $package->assembly->Package . '=' . $package->assembly->Version); + $installation_paths = new InstallationPaths($this->packages_path . DIRECTORY_SEPARATOR . $package->assembly->package . '=' . $package->assembly->version); $installer = match ($extension) { @@ -152,20 +152,20 @@ default => throw new UnsupportedCompilerExtensionException('The compiler extension \'' . $extension . '\' is not supported'), }; - if($this->getPackageVersion($package->assembly->Package, $package->assembly->Version) !== null) + if($this->getPackageVersion($package->assembly->package, $package->assembly->version) !== null) { if(in_array(InstallPackageOptions::REINSTALL, $options, true)) { - if($this->getPackageLockManager()?->getPackageLock()?->packageExists($package->assembly->Package, $package->assembly->Version)) + if($this->getPackageLockManager()?->getPackageLock()?->packageExists($package->assembly->package, $package->assembly->version)) { $this->getPackageLockManager()?->getPackageLock()?->removePackageVersion( - $package->assembly->Package, $package->assembly->Version + $package->assembly->package, $package->assembly->version ); } } else { - throw new PackageAlreadyInstalledException('The package ' . $package->assembly->Package . '=' . $package->assembly->Version . ' is already installed'); + throw new PackageAlreadyInstalledException('The package ' . $package->assembly->package . '=' . $package->assembly->version . ' is already installed'); } } @@ -216,7 +216,7 @@ } } - Console::out('Installing ' . $package->assembly->Package); + Console::out('Installing ' . $package->assembly->package); // Four For Directory Creation, preInstall, postInstall & initData methods $steps = (4 + count($package->components) + count ($package->resources) + count ($package->execution_units)); @@ -367,7 +367,7 @@ foreach($package->execution_units as $executionUnit) { Console::outDebug(sprintf('processing execution unit %s', $executionUnit->execution_policy->name)); - $execution_pointer_manager->addUnit($package->assembly->Package, $package->assembly->Version, $executionUnit); + $execution_pointer_manager->addUnit($package->assembly->package, $package->assembly->version, $executionUnit); ++$current_steps; Console::inlineProgressBar($current_steps, $steps); } @@ -387,10 +387,10 @@ throw new InstallationException('Cannot create symlink, no main execution policy is defined'); } - Console::outDebug(sprintf('creating symlink to %s', $package->assembly->Package)); + Console::outDebug(sprintf('creating symlink to %s', $package->assembly->package)); $SymlinkManager = new SymlinkManager(); - $SymlinkManager->add($package->assembly->Package, $package->main_execution_policy); + $SymlinkManager->add($package->assembly->package, $package->main_execution_policy); } // Execute the post-installation stage after the installation is complete @@ -437,14 +437,14 @@ if($package->header->UpdateSource !== null && $package->header->UpdateSource->repository !== null) { $sources_manager = new RemoteSourcesManager(); - if($sources_manager->getRemoteSource($package->header->UpdateSource->repository->Name) === null) + if($sources_manager->getRemoteSource($package->header->UpdateSource->repository->name) === null) { - Console::outVerbose('Adding remote source ' . $package->header->UpdateSource->repository->Name); + Console::outVerbose('Adding remote source ' . $package->header->UpdateSource->repository->name); $defined_remote_source = new DefinedRemoteSource(); - $defined_remote_source->name = $package->header->UpdateSource->repository->Name; - $defined_remote_source->host = $package->header->UpdateSource->repository->Host; - $defined_remote_source->type = $package->header->UpdateSource->repository->Type; - $defined_remote_source->ssl = $package->header->UpdateSource->repository->SSL; + $defined_remote_source->name = $package->header->UpdateSource->repository->name; + $defined_remote_source->host = $package->header->UpdateSource->repository->host; + $defined_remote_source->type = $package->header->UpdateSource->repository->type; + $defined_remote_source->ssl = $package->header->UpdateSource->repository->ssl; $sources_manager->addRemoteSource($defined_remote_source); } @@ -453,9 +453,9 @@ $this->getPackageLockManager()?->getPackageLock()?->addPackage($package, $installation_paths->getInstallationPath()); $this->getPackageLockManager()?->save(); - RuntimeCache::set(sprintf('installed.%s=%s', $package->assembly->Package, $package->assembly->Version), true); + RuntimeCache::set(sprintf('installed.%s=%s', $package->assembly->package, $package->assembly->version), true); - return $package->assembly->Package; + return $package->assembly->package; } /** @@ -702,7 +702,7 @@ if ($dependency->source_type !== null && !$dependency_met) { - Console::outVerbose(sprintf('Installing dependency %s=%s for %s=%s', $dependency->name, $dependency->version, $package->assembly->Package, $package->assembly->Version)); + Console::outVerbose(sprintf('Installing dependency %s=%s for %s=%s', $dependency->name, $dependency->version, $package->assembly->package, $package->assembly->version)); switch ($dependency->source_type) { case DependencySourceType::LOCAL: @@ -733,7 +733,7 @@ } elseif(!$dependency_met) { - throw new MissingDependencyException(sprintf('The dependency %s=%s for %s=%s is not met', $dependency->name, $dependency->version, $package->assembly->Package, $package->assembly->Version)); + throw new MissingDependencyException(sprintf('The dependency %s=%s for %s=%s is not met', $dependency->name, $dependency->version, $package->assembly->package, $package->assembly->version)); } } @@ -1024,7 +1024,7 @@ */ private static function initData(Package $package, InstallationPaths $paths): void { - Console::outVerbose(sprintf('Initializing data for %s', $package->assembly->Name)); + Console::outVerbose(sprintf('Initializing data for %s', $package->assembly->name)); // Create data files $dependencies = []; diff --git a/src/ncc/Managers/ProjectManager.php b/src/ncc/Managers/ProjectManager.php index 73d6e90..0b1c9f2 100644 --- a/src/ncc/Managers/ProjectManager.php +++ b/src/ncc/Managers/ProjectManager.php @@ -139,10 +139,10 @@ $this->project_configuration->project->compiler = $compiler; // Set the assembly information - $this->project_configuration->assembly->Name = $name; - $this->project_configuration->assembly->Package = $package; - $this->project_configuration->assembly->Version = '1.0.0'; - $this->project_configuration->assembly->UUID = Uuid::v1()->toRfc4122(); + $this->project_configuration->assembly->name = $name; + $this->project_configuration->assembly->package = $package; + $this->project_configuration->assembly->version = '1.0.0'; + $this->project_configuration->assembly->uuid = Uuid::v1()->toRfc4122(); // Set the build information $this->project_configuration->build->source_path = $src; @@ -162,14 +162,14 @@ // Generate configurations $DebugConfiguration = new ProjectConfiguration\Build\BuildConfiguration(); - $DebugConfiguration->Name = 'debug'; - $DebugConfiguration->OutputPath = 'build/debug'; - $DebugConfiguration->DefineConstants["DEBUG"] = '1'; // Debugging constant if the program wishes to check for this + $DebugConfiguration->name = 'debug'; + $DebugConfiguration->output_path = 'build/debug'; + $DebugConfiguration->define_constants["DEBUG"] = '1'; // Debugging constant if the program wishes to check for this $this->project_configuration->build->build_configurations[] = $DebugConfiguration; $ReleaseConfiguration = new ProjectConfiguration\Build\BuildConfiguration(); - $ReleaseConfiguration->Name = 'release'; - $ReleaseConfiguration->OutputPath = 'build/release'; - $ReleaseConfiguration->DefineConstants["DEBUG"] = '0'; // Debugging constant if the program wishes to check for this + $ReleaseConfiguration->name = 'release'; + $ReleaseConfiguration->output_path = 'build/release'; + $ReleaseConfiguration->define_constants["DEBUG"] = '0'; // Debugging constant if the program wishes to check for this $this->project_configuration->build->build_configurations[] = $ReleaseConfiguration; // Finally, create project.json diff --git a/src/ncc/Objects/PackageLock.php b/src/ncc/Objects/PackageLock.php index 6e3be00..e1dc7cd 100644 --- a/src/ncc/Objects/PackageLock.php +++ b/src/ncc/Objects/PackageLock.php @@ -84,24 +84,24 @@ */ public function addPackage(Package $package, string $install_path): void { - Console::outVerbose("Adding package {$package->assembly->Package} to package lock file"); + Console::outVerbose("Adding package {$package->assembly->package} to package lock file"); - if(!isset($this->Packages[$package->assembly->Package])) + if(!isset($this->Packages[$package->assembly->package])) { $package_entry = new PackageEntry(); $package_entry->addVersion($package, $install_path, true); - $package_entry->Name = $package->assembly->Package; + $package_entry->Name = $package->assembly->package; $package_entry->UpdateSource = $package->header->UpdateSource; $package_entry->getDataPath(); - $this->Packages[$package->assembly->Package] = $package_entry; + $this->Packages[$package->assembly->package] = $package_entry; $this->update(); return; } - $this->Packages[$package->assembly->Package]->UpdateSource = $package->header->UpdateSource; - $this->Packages[$package->assembly->Package]->addVersion($package, $install_path, true); - $this->Packages[$package->assembly->Package]->getDataPath(); + $this->Packages[$package->assembly->package]->UpdateSource = $package->header->UpdateSource; + $this->Packages[$package->assembly->package]->addVersion($package, $install_path, true); + $this->Packages[$package->assembly->package]->getDataPath(); $this->update(); } diff --git a/src/ncc/Objects/PackageLock/PackageEntry.php b/src/ncc/Objects/PackageLock/PackageEntry.php index 7905679..c85ea22 100644 --- a/src/ncc/Objects/PackageLock/PackageEntry.php +++ b/src/ncc/Objects/PackageLock/PackageEntry.php @@ -154,14 +154,14 @@ { try { - if ($this->getVersion($package->assembly->Version) !== null) + if ($this->getVersion($package->assembly->version) !== null) { if(!$overwrite) { return false; } - $this->removeVersion($package->assembly->Version); + $this->removeVersion($package->assembly->version); } } catch (VersionNotFoundException $e) @@ -170,7 +170,7 @@ } $version = new VersionEntry(); - $version->Version = $package->assembly->Version; + $version->Version = $package->assembly->version; $version->Compiler = $package->header->CompilerExtension; $version->ExecutionUnits = $package->execution_units; $version->MainExecutionPolicy = $package->main_execution_policy; diff --git a/src/ncc/Objects/ProjectConfiguration.php b/src/ncc/Objects/ProjectConfiguration.php index df5848b..81b6ac1 100644 --- a/src/ncc/Objects/ProjectConfiguration.php +++ b/src/ncc/Objects/ProjectConfiguration.php @@ -331,44 +331,44 @@ if($execution_policy?->exit_handlers !== null) { if( - $execution_policy?->exit_handlers->Success !== null && - $execution_policy?->exit_handlers->Success->Run !== null + $execution_policy?->exit_handlers->success !== null && + $execution_policy?->exit_handlers->success->run !== null ) { - if(!in_array($execution_policy?->exit_handlers->Success->Run, $defined_polices, true)) + 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 UndefinedExecutionPolicyException('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)) + if(!in_array($execution_policy?->exit_handlers->success->run, $required_policies, true)) { - $required_policies[] = $execution_policy?->exit_handlers->Success->Run; + $required_policies[] = $execution_policy?->exit_handlers->success->run; } } - if($execution_policy?->exit_handlers->Warning !== null && $execution_policy?->exit_handlers->Warning->Run !== null) + if($execution_policy?->exit_handlers->warning !== null && $execution_policy?->exit_handlers->warning->run !== null) { - if(!in_array($execution_policy?->exit_handlers->Warning->Run, $defined_polices, true)) + 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 UndefinedExecutionPolicyException('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)) + if(!in_array($execution_policy?->exit_handlers->warning->run, $required_policies, true)) { - $required_policies[] = $execution_policy?->exit_handlers->Warning->Run; + $required_policies[] = $execution_policy?->exit_handlers->warning->run; } } - if($execution_policy?->exit_handlers->Error !== null && $execution_policy?->exit_handlers->Error->Run !== null) + if($execution_policy?->exit_handlers->error !== null && $execution_policy?->exit_handlers->error->run !== null) { - if(!in_array($execution_policy?->exit_handlers->Error->Run, $defined_polices, true)) + 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 UndefinedExecutionPolicyException('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)) + if(!in_array($execution_policy?->exit_handlers->error->run, $required_policies, true)) { - $required_policies[] = $execution_policy?->exit_handlers->Error->Run; + $required_policies[] = $execution_policy?->exit_handlers->error->run; } } } @@ -423,26 +423,26 @@ { $required_policies = []; - if ($configuration->PreBuild !== null && count($configuration->PreBuild) > 0) + if ($configuration->pre_build !== null && count($configuration->pre_build) > 0) { - foreach ($configuration->PreBuild as $unit) + foreach ($configuration->pre_build as $unit) { 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 UndefinedExecutionPolicyException('The property \'pre_build\' in the build configuration \'' . $configuration->name . '\' calls for an undefined execution policy \'' . $unit . '\''); } $required_policies[] = $unit; } } - if ($configuration->PostBuild !== null && count($configuration->PostBuild) > 0) + if ($configuration->post_build !== null && count($configuration->post_build) > 0) { - foreach ($configuration->PostBuild as $unit) + foreach ($configuration->post_build as $unit) { 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 UndefinedExecutionPolicyException('The property \'pre_build\' in the build configuration \'' . $configuration->name . '\' calls for an undefined execution policy \'' . $unit . '\''); } $required_policies[] = $unit; diff --git a/src/ncc/Objects/ProjectConfiguration/Assembly.php b/src/ncc/Objects/ProjectConfiguration/Assembly.php index 1daf921..bbef8a5 100644 --- a/src/ncc/Objects/ProjectConfiguration/Assembly.php +++ b/src/ncc/Objects/ProjectConfiguration/Assembly.php @@ -1,24 +1,24 @@ UUID)) + if(!preg_match(RegexPatterns::UUID, $this->uuid)) { if($throw_exception) + { throw new InvalidProjectConfigurationException('The UUID is not a valid v4 UUID', 'Assembly.UUID'); + } + return false; } - if($this->Version !== null && !Validate::version($this->Version)) + if($this->version !== null && !Validate::version($this->version)) { if($throw_exception) + { throw new InvalidProjectConfigurationException('The version number is invalid', 'Assembly.Version'); + } return false; } - if($this->Package !== null && !preg_match(RegexPatterns::PACKAGE_NAME_FORMAT, $this->Package)) + if($this->package !== null && !preg_match(RegexPatterns::PACKAGE_NAME_FORMAT, $this->package)) { if($throw_exception) + { throw new InvalidProjectConfigurationException('The package name is invalid', 'Assembly.Package'); + } return false; } - if($this->Name !== null && strlen($this->Name) > 126) + if($this->name !== null && strlen($this->name) > 126) { if($throw_exception) + { throw new InvalidProjectConfigurationException('The name cannot be larger than 126 characters', 'Assembly.Name'); + } return false; } - if($this->Description !== null && strlen($this->Description) > 512) + if($this->description !== null && strlen($this->description) > 512) { if($throw_exception) + { throw new InvalidProjectConfigurationException('The description cannot be larger than 512 characters', 'Assembly.Description'); + } return false; } - if($this->Company !== null && strlen($this->Company) > 126) + if($this->company !== null && strlen($this->company) > 126) { if($throw_exception) + { throw new InvalidProjectConfigurationException('The company cannot be larger than 126 characters', 'Assembly.Company'); + } return false; } - if($this->Product !== null && strlen($this->Product) > 256) + if($this->product !== null && strlen($this->product) > 256) { if($throw_exception) + { throw new InvalidProjectConfigurationException('The company cannot be larger than 256 characters', 'Assembly.Product'); + } return false; } - if($this->Copyright !== null && strlen($this->Copyright) > 256) + if($this->copyright !== null && strlen($this->copyright) > 256) { if($throw_exception) + { throw new InvalidProjectConfigurationException('The copyright cannot be larger than 256 characters', 'Assembly.Copyright'); + } return false; } - if($this->Trademark !== null && strlen($this->Trademark) > 256) + if($this->trademark !== null && strlen($this->trademark) > 256) { if($throw_exception) + { throw new InvalidProjectConfigurationException('The trademark cannot be larger than 256 characters', 'Assembly.Trademark'); + } return false; } @@ -180,65 +200,77 @@ } /** - * Returns an array representation of the object - * - * @param bool $bytecode - * @return array + * @inheritDoc */ public function toArray(bool $bytecode=false): array { - $return_results = []; + $results = []; - if($this->Name !== null && strlen($this->Name) > 0) - $return_results[($bytecode ? Functions::cbc('name') : 'name')] = $this->Name; + if($this->name !== null && $this->name !== '') + { + $results[($bytecode ? Functions::cbc('name') : 'name')] = $this->name; + } - if($this->Package !== null && strlen($this->Package) > 0) - $return_results[($bytecode ? Functions::cbc('package') : 'package')] = $this->Package; + if($this->package !== null && $this->package !== '') + { + $results[($bytecode ? Functions::cbc('package') : 'package')] = $this->package; + } - if($this->Description !== null && strlen($this->Description) > 0) - $return_results[($bytecode ? Functions::cbc('description') : 'description')] = $this->Description; + if($this->description !== null && $this->description !== '') + { + $results[($bytecode ? Functions::cbc('description') : 'description')] = $this->description; + } - if($this->Company !== null && strlen($this->Company) > 0) - $return_results[($bytecode ? Functions::cbc('company') : 'company')] = $this->Company; + if($this->company !== null && $this->company !== '') + { + $results[($bytecode ? Functions::cbc('company') : 'company')] = $this->company; + } - if($this->Product !== null && strlen($this->Product) > 0) - $return_results[($bytecode ? Functions::cbc('product') : 'product')] = $this->Product; + if($this->product !== null && $this->product !== '') + { + $results[($bytecode ? Functions::cbc('product') : 'product')] = $this->product; + } - if($this->Copyright !== null && strlen($this->Copyright) > 0) - $return_results[($bytecode ? Functions::cbc('copyright') : 'copyright')] = $this->Copyright; + if($this->copyright !== null && $this->copyright !== '') + { + $results[($bytecode ? Functions::cbc('copyright') : 'copyright')] = $this->copyright; + } - if($this->Trademark !== null && strlen($this->Trademark) > 0) - $return_results[($bytecode ? Functions::cbc('trademark') : 'trademark')] = $this->Trademark; + if($this->trademark !== null && $this->trademark !== '') + { + $results[($bytecode ? Functions::cbc('trademark') : 'trademark')] = $this->trademark; + } - if($this->Version !== null && strlen($this->Version) > 0) - $return_results[($bytecode ? Functions::cbc('version') : 'version')] = $this->Version; + if($this->version !== null && $this->version !== '') + { + $results[($bytecode ? Functions::cbc('version') : 'version')] = $this->version; + } - if($this->UUID !== null && strlen($this->UUID) > 0) - $return_results[($bytecode ? Functions::cbc('uuid') : 'uuid')] = $this->UUID; + if($this->uuid !== null && $this->uuid !== '') + { + $results[($bytecode ? Functions::cbc('uuid') : 'uuid')] = $this->uuid; + } - return $return_results; + return $results; } /** - * Constructs object from an array representation - * - * @param array $data - * @return Assembly + * @inheritDoc */ public static function fromArray(array $data): Assembly { - $AssemblyObject = new Assembly(); + $object = new self(); - $AssemblyObject->Name = Functions::array_bc($data, 'name'); - $AssemblyObject->Package = Functions::array_bc($data, 'package'); - $AssemblyObject->Description = Functions::array_bc($data, 'description'); - $AssemblyObject->Company = Functions::array_bc($data, 'company'); - $AssemblyObject->Product = Functions::array_bc($data, 'product'); - $AssemblyObject->Copyright = Functions::array_bc($data, 'copyright'); - $AssemblyObject->Trademark = Functions::array_bc($data, 'trademark'); - $AssemblyObject->Version = Functions::array_bc($data, 'version'); - $AssemblyObject->UUID = Functions::array_bc($data, 'uuid'); + $object->name = Functions::array_bc($data, 'name'); + $object->package = Functions::array_bc($data, 'package'); + $object->description = Functions::array_bc($data, 'description'); + $object->company = Functions::array_bc($data, 'company'); + $object->product = Functions::array_bc($data, 'product'); + $object->copyright = Functions::array_bc($data, 'copyright'); + $object->trademark = Functions::array_bc($data, 'trademark'); + $object->version = Functions::array_bc($data, 'version'); + $object->uuid = Functions::array_bc($data, 'uuid'); - return $AssemblyObject; + return $object; } } \ No newline at end of file diff --git a/src/ncc/Objects/ProjectConfiguration/Build.php b/src/ncc/Objects/ProjectConfiguration/Build.php index fd56669..e35952b 100644 --- a/src/ncc/Objects/ProjectConfiguration/Build.php +++ b/src/ncc/Objects/ProjectConfiguration/Build.php @@ -192,11 +192,11 @@ $build_configurations = []; foreach($this->build_configurations as $configuration) { - if(in_array($configuration->Name, $build_configurations, true)) + if(in_array($configuration->name, $build_configurations, true)) { if($throw_exception) { - throw new InvalidProjectBuildConfiguration('The build configuration \'' . $configuration->Name . '\' is already defined, build configuration names must be unique'); + throw new InvalidProjectBuildConfiguration('The build configuration \'' . $configuration->name . '\' is already defined, build configuration names must be unique'); } return false; @@ -214,7 +214,7 @@ } catch (InvalidBuildConfigurationException $e) { - throw new InvalidBuildConfigurationException(sprintf('Error in build configuration \'%s\'', $configuration->Name), $e); + throw new InvalidBuildConfigurationException(sprintf('Error in build configuration \'%s\'', $configuration->name), $e); } } @@ -255,7 +255,7 @@ foreach($this->build_configurations as $configuration) { - $build_configurations[] = $configuration->Name; + $build_configurations[] = $configuration->name; } return $build_configurations; @@ -278,7 +278,7 @@ foreach($this->build_configurations as $configuration) { - if($configuration->Name === $name) + if($configuration->name === $name) { return $configuration; } diff --git a/src/ncc/Objects/ProjectConfiguration/Build/BuildConfiguration.php b/src/ncc/Objects/ProjectConfiguration/Build/BuildConfiguration.php index 22ed725..d388653 100644 --- a/src/ncc/Objects/ProjectConfiguration/Build/BuildConfiguration.php +++ b/src/ncc/Objects/ProjectConfiguration/Build/BuildConfiguration.php @@ -1,24 +1,24 @@ Options = []; - $this->OutputPath = 'build'; - $this->DefineConstants = []; - $this->ExcludeFiles = []; - $this->PreBuild = []; - $this->PostBuild = []; - $this->Dependencies = []; + $this->options = []; + $this->output_path = 'build'; + $this->define_constants = []; + $this->exclude_files = []; + $this->pre_build = []; + $this->post_build = []; + $this->dependencies = []; } /** @@ -116,74 +117,92 @@ */ public function validate(bool $throw_exception=True): bool { - if(!Validate::nameFriendly($this->Name)) + if(!Validate::nameFriendly($this->name)) { if($throw_exception) - throw new InvalidBuildConfigurationException(sprintf('Invalid build configuration name "%s"', $this->Name)); + { + throw new InvalidBuildConfigurationException(sprintf('Invalid build configuration name "%s"', $this->name)); + } return False; } - if(!Validate::pathName($this->OutputPath)) + if(!Validate::pathName($this->output_path)) { if($throw_exception) - throw new InvalidBuildConfigurationException(sprintf('\'output_path\' contains an invalid path name in %s', $this->Name)); + { + throw new InvalidBuildConfigurationException(sprintf('\'output_path\' contains an invalid path name in %s', $this->name)); + } return False; } - if($this->DefineConstants !== null && !is_array($this->DefineConstants)) + if($this->define_constants !== null && !is_array($this->define_constants)) { if($throw_exception) - throw new InvalidBuildConfigurationException(sprintf('\'define_constants\' must be an array in %s', $this->Name)); + { + throw new InvalidBuildConfigurationException(sprintf('\'define_constants\' must be an array in %s', $this->name)); + } return False; } - if($this->ExcludeFiles !== null && !is_array($this->ExcludeFiles)) + if($this->exclude_files !== null && !is_array($this->exclude_files)) { if($throw_exception) - throw new InvalidBuildConfigurationException(sprintf('\'exclude_files\' must be an array in %s', $this->Name)); + { + throw new InvalidBuildConfigurationException(sprintf('\'exclude_files\' must be an array in %s', $this->name)); + } return False; } - if($this->PreBuild !== null && !is_array($this->PreBuild)) + if($this->pre_build !== null && !is_array($this->pre_build)) { if($throw_exception) - throw new InvalidBuildConfigurationException(sprintf('\'pre_build\' must be an array in %s', $this->Name)); + { + throw new InvalidBuildConfigurationException(sprintf('\'pre_build\' must be an array in %s', $this->name)); + } return False; } - if($this->PostBuild !== null && !is_array($this->PostBuild)) + if($this->post_build !== null && !is_array($this->post_build)) { if($throw_exception) - throw new InvalidBuildConfigurationException(sprintf('\'post_build\' must be an array in %s', $this->Name)); + { + throw new InvalidBuildConfigurationException(sprintf('\'post_build\' must be an array in %s', $this->name)); + } return False; } - if($this->Dependencies !== null && !is_array($this->Dependencies)) + if($this->dependencies !== null && !is_array($this->dependencies)) { if($throw_exception) - throw new InvalidBuildConfigurationException(sprintf('\'dependencies\' must be an array in %s', $this->Name)); + { + throw new InvalidBuildConfigurationException(sprintf('\'dependencies\' must be an array in %s', $this->name)); + } return False; } /** @var Dependency $dependency */ - foreach($this->Dependencies as $dependency) + foreach($this->dependencies as $dependency) { try { if (!$dependency->validate($throw_exception)) + { return False; + } } catch (InvalidDependencyConfiguration $e) { if($throw_exception) - throw new InvalidBuildConfigurationException(sprintf('Invalid dependency configuration in %s: %s', $this->Name, $e->getMessage())); + { + throw new InvalidBuildConfigurationException(sprintf('Invalid dependency configuration in %s: %s', $this->name, $e->getMessage())); + } return False; } @@ -193,64 +212,78 @@ } /** - * Returns an array representation of the object - * - * @param boolean $bytecode - * @return array + * @inheritDoc */ public function toArray(bool $bytecode=false): array { - $ReturnResults = []; + $results = []; - if($this->Name !== null && strlen($this->Name) > 0) - $ReturnResults[($bytecode ? Functions::cbc('name') : 'name')] = $this->Name; - if($this->Options !== null && count($this->Options) > 0) - $ReturnResults[($bytecode ? Functions::cbc('options') : 'options')] = $this->Options; - if($this->OutputPath !== null && strlen($this->OutputPath) > 0) - $ReturnResults[($bytecode ? Functions::cbc('output_path') : 'output_path')] = $this->OutputPath; - if($this->DefineConstants !== null && count($this->DefineConstants) > 0) - $ReturnResults[($bytecode ? Functions::cbc('define_constants') : 'define_constants')] = $this->DefineConstants; - if($this->ExcludeFiles !== null && count($this->ExcludeFiles) > 0) - $ReturnResults[($bytecode ? Functions::cbc('exclude_files') : 'exclude_files')] = $this->ExcludeFiles; - if($this->PreBuild !== null && count($this->PreBuild) > 0) - $ReturnResults[($bytecode ? Functions::cbc('pre_build') : 'pre_build')] = $this->PreBuild; - if($this->Dependencies !== null && count($this->Dependencies) > 0) + if($this->name !== null && $this->name !== '') { - $Dependencies = []; - foreach($this->Dependencies as $Dependency) - { - $Dependencies[] = $Dependency->toArray($bytecode); - } - $ReturnResults[($bytecode ? Functions::cbc('dependencies') : 'dependencies')] = $Dependencies; + $results[($bytecode ? Functions::cbc('name') : 'name')] = $this->name; } - return $ReturnResults; + if($this->options !== null && count($this->options) > 0) + { + $results[($bytecode ? Functions::cbc('options') : 'options')] = $this->options; + } + + if($this->output_path !== null && $this->output_path !== '') + { + $results[($bytecode ? Functions::cbc('output_path') : 'output_path')] = $this->output_path; + } + + if($this->define_constants !== null && count($this->define_constants) > 0) + { + $results[($bytecode ? Functions::cbc('define_constants') : 'define_constants')] = $this->define_constants; + } + + if($this->exclude_files !== null && count($this->exclude_files) > 0) + { + $results[($bytecode ? Functions::cbc('exclude_files') : 'exclude_files')] = $this->exclude_files; + } + + if($this->pre_build !== null && count($this->pre_build) > 0) + { + $results[($bytecode ? Functions::cbc('pre_build') : 'pre_build')] = $this->pre_build; + } + + if($this->dependencies !== null && count($this->dependencies) > 0) + { + $dependencies = array_map(static function(Dependency $Dependency) use ($bytecode) + { + return $Dependency->toArray($bytecode); + }, $this->dependencies); + + $results[($bytecode ? Functions::cbc('dependencies') : 'dependencies')] = $dependencies; + } + + return $results; } /** - * Constructs the object from an array representation - * - * @param array $data - * @return BuildConfiguration + * @inheritDoc */ public static function fromArray(array $data): BuildConfiguration { - $BuildConfigurationObject = new BuildConfiguration(); + $object = new BuildConfiguration(); - $BuildConfigurationObject->Name = Functions::array_bc($data, 'name'); - $BuildConfigurationObject->Options = Functions::array_bc($data, 'options'); - $BuildConfigurationObject->OutputPath = Functions::array_bc($data, 'output_path'); - $BuildConfigurationObject->DefineConstants = Functions::array_bc($data, 'define_constants'); - $BuildConfigurationObject->ExcludeFiles = Functions::array_bc($data, 'exclude_files'); - $BuildConfigurationObject->PreBuild = Functions::array_bc($data, 'pre_build'); - $BuildConfigurationObject->PostBuild = Functions::array_bc($data, 'post_build'); + $object->name = Functions::array_bc($data, 'name'); + $object->options = Functions::array_bc($data, 'options'); + $object->output_path = Functions::array_bc($data, 'output_path'); + $object->define_constants = Functions::array_bc($data, 'define_constants'); + $object->exclude_files = Functions::array_bc($data, 'exclude_files'); + $object->pre_build = Functions::array_bc($data, 'pre_build'); + $object->post_build = Functions::array_bc($data, 'post_build'); if(Functions::array_bc($data, 'dependencies') !== null) { foreach(Functions::array_bc($data, 'dependencies') as $item) - $BuildConfigurationObject->Dependencies[] = Dependency::fromArray($item); + { + $object->dependencies[] = Dependency::fromArray($item); + } } - return $BuildConfigurationObject; + return $object; } } \ No newline at end of file diff --git a/src/ncc/Objects/ProjectConfiguration/ExecutionPolicy/Execute.php b/src/ncc/Objects/ProjectConfiguration/ExecutionPolicy/Execute.php index 6839d88..908ab07 100644 --- a/src/ncc/Objects/ProjectConfiguration/ExecutionPolicy/Execute.php +++ b/src/ncc/Objects/ProjectConfiguration/ExecutionPolicy/Execute.php @@ -1,39 +1,40 @@ Tty = false; - $this->Silent = false; - $this->Timeout = null; - $this->IdleTimeout = null; - $this->WorkingDirectory = "%CWD%"; + $this->tty = false; + $this->silent = false; + $this->timeout = null; + $this->idle_timeout = null; + $this->working_directory = "%CWD%"; } /** - * Returns an array representation of the object - * - * @param bool $bytecode - * @return array + * @inheritDoc */ public function toArray(bool $bytecode=false): array { $results = []; - if($this->Target !== null) - $results[($bytecode ? Functions::cbc("target") : "target")] = $this->Target; + if($this->target !== null) + { + $results[($bytecode ? Functions::cbc('target') : 'target')] = $this->target; + } - if($this->WorkingDirectory !== null) - $results[($bytecode ? Functions::cbc("working_directory") : "working_directory")] = $this->WorkingDirectory; + if($this->working_directory !== null) + { + $results[($bytecode ? Functions::cbc('working_directory') : 'working_directory')] = $this->working_directory; + } - if($this->Options !== null) - $results[($bytecode ? Functions::cbc("options") : "options")] = $this->Options; + if($this->options !== null) + { + $results[($bytecode ? Functions::cbc('options') : 'options')] = $this->options; + } - if($this->EnvironmentVariables !== null) - $results[($bytecode ? Functions::cbc("environment_variables") : "environment_variables")] = $this->EnvironmentVariables; + if($this->environment_variables !== null) + { + $results[($bytecode ? Functions::cbc('environment_variables') : 'environment_variables')] = $this->environment_variables; + } - if($this->Silent !== null) - $results[($bytecode ? Functions::cbc("silent") : "silent")] = (bool)$this->Silent; + if($this->silent !== null) + { + $results[($bytecode ? Functions::cbc('silent') : 'silent')] = (bool)$this->silent; + } - if($this->Tty !== null) - $results[($bytecode ? Functions::cbc("tty") : "tty")] = (bool)$this->Tty; + if($this->tty !== null) + { + $results[($bytecode ? Functions::cbc('tty') : 'tty')] = (bool)$this->tty; + } - if($this->Timeout !== null) - $results[($bytecode ? Functions::cbc("timeout") : "timeout")] = (int)$this->Timeout; + if($this->timeout !== null) + { + $results[($bytecode ? Functions::cbc('timeout') : 'timeout')] = (int)$this->timeout; + } - if($this->IdleTimeout !== null) - $results[($bytecode ? Functions::cbc("idle_timeout") : "idle_timeout")] = (int)$this->IdleTimeout; + if($this->idle_timeout !== null) + { + $results[($bytecode ? Functions::cbc('idle_timeout') : 'idle_timeout')] = (int)$this->idle_timeout; + } return $results; } /** - * Constructs object from an array representation - * - * @param array $data - * @return Execute + * @inheritDoc */ - public static function fromArray(array $data): self + public static function fromArray(array $data): Execute { $object = new self(); - $object->Target = Functions::array_bc($data, 'target'); - $object->WorkingDirectory = Functions::array_bc($data, 'working_directory'); - $object->Options = Functions::array_bc($data, 'options'); - $object->EnvironmentVariables = Functions::array_bc($data, 'environment_variables'); - $object->Silent = Functions::array_bc($data, 'silent'); - $object->Tty = Functions::array_bc($data, 'tty'); - $object->Timeout = Functions::array_bc($data, 'timeout'); - $object->IdleTimeout = Functions::array_bc($data, 'idle_timeout'); + $object->target = Functions::array_bc($data, 'target'); + $object->working_directory = Functions::array_bc($data, 'working_directory'); + $object->options = Functions::array_bc($data, 'options'); + $object->environment_variables = Functions::array_bc($data, 'environment_variables'); + $object->silent = Functions::array_bc($data, 'silent'); + $object->tty = Functions::array_bc($data, 'tty'); + $object->timeout = Functions::array_bc($data, 'timeout'); + $object->idle_timeout = Functions::array_bc($data, 'idle_timeout'); return $object; } diff --git a/src/ncc/Objects/ProjectConfiguration/ExecutionPolicy/ExitHandle.php b/src/ncc/Objects/ProjectConfiguration/ExecutionPolicy/ExitHandle.php index 176858f..6adbea2 100644 --- a/src/ncc/Objects/ProjectConfiguration/ExecutionPolicy/ExitHandle.php +++ b/src/ncc/Objects/ProjectConfiguration/ExecutionPolicy/ExitHandle.php @@ -1,39 +1,40 @@ Message !== null) - $return_results[($bytecode ? Functions::cbc('message') : 'message')] = $this->Message; + if($this->message !== null) + { + $results[($bytecode ? Functions::cbc('message') : 'message')] = $this->message; + } - if($this->EndProcess !== null) - $return_results[($bytecode ? Functions::cbc('end_process') : 'end_process')] = $this->EndProcess; + if($this->end_process !== null) + { + $results[($bytecode ? Functions::cbc('end_process') : 'end_process')] = $this->end_process; + } - if($this->Run !== null) - $return_results[($bytecode ? Functions::cbc('run') : 'run')] = $this->Run; + if($this->run !== null) + { + $results[($bytecode ? Functions::cbc('run') : 'run')] = $this->run; + } /** @noinspection PhpCastIsUnnecessaryInspection */ - $return_results[($bytecode ? Functions::cbc('exit_code') : 'exit_code')] = (int)$this->ExitCode; + $results[($bytecode ? Functions::cbc('exit_code') : 'exit_code')] = (int)$this->exit_code; - return $return_results; + return $results; } /** - * Constructs object from an array representation - * - * @param array $data - * @return ExitHandle + * @inheritDoc */ - public static function fromArray(array $data): self + public static function fromArray(array $data): ExitHandle { $object = new self(); - $object->Message = Functions::array_bc($data, 'message'); - $object->EndProcess = Functions::array_bc($data, 'end_process'); - $object->Run = Functions::array_bc($data, 'run'); - $object->ExitCode = Functions::array_bc($data, 'exit_code'); + $object->message = Functions::array_bc($data, 'message'); + $object->end_process = Functions::array_bc($data, 'end_process'); + $object->run = Functions::array_bc($data, 'run'); + $object->exit_code = Functions::array_bc($data, 'exit_code'); return $object; } diff --git a/src/ncc/Objects/ProjectConfiguration/ExecutionPolicy/ExitHandlers.php b/src/ncc/Objects/ProjectConfiguration/ExecutionPolicy/ExitHandlers.php index 6f83e35..e854650 100644 --- a/src/ncc/Objects/ProjectConfiguration/ExecutionPolicy/ExitHandlers.php +++ b/src/ncc/Objects/ProjectConfiguration/ExecutionPolicy/ExitHandlers.php @@ -1,90 +1,91 @@ $this->Success?->toArray($bytecode), - ($bytecode ? Functions::cbc('warning') : 'warning') => $this->Warning?->toArray($bytecode), - ($bytecode ? Functions::cbc('error') : 'error') => $this->Error?->toArray($bytecode), + ($bytecode ? Functions::cbc('success') : 'success') => $this->success?->toArray($bytecode), + ($bytecode ? Functions::cbc('warning') : 'warning') => $this->warning?->toArray($bytecode), + ($bytecode ? Functions::cbc('error') : 'error') => $this->error?->toArray($bytecode), ]; } /** - * Constructs object from an array representation - * - * @param array $data - * @return ExitHandlers + * @inheritDoc */ public static function fromArray(array $data): self { $object = new self(); - $object->Success = Functions::array_bc($data, 'success'); - if($object->Success !== null) - $object->Success = ExitHandle::fromArray($object->Success); + $object->success = Functions::array_bc($data, 'success'); + if($object->success !== null) + { + $object->success = ExitHandle::fromArray($object->success); + } - $object->Warning = Functions::array_bc($data, 'warning'); - if($object->Warning !== null) - $object->Warning = ExitHandle::fromArray($object->Warning); + $object->warning = Functions::array_bc($data, 'warning'); + if($object->warning !== null) + { + $object->warning = ExitHandle::fromArray($object->warning); + } - $object->Error = Functions::array_bc($data, 'error'); - if($object->Error !== null) - $object->Error = ExitHandle::fromArray($object->Error); + $object->error = Functions::array_bc($data, 'error'); + if($object->error !== null) + { + $object->error = ExitHandle::fromArray($object->error); + } return $object; } diff --git a/src/ncc/Objects/ProjectConfiguration/UpdateSource/Repository.php b/src/ncc/Objects/ProjectConfiguration/UpdateSource/Repository.php index 395e215..3cd86bd 100644 --- a/src/ncc/Objects/ProjectConfiguration/UpdateSource/Repository.php +++ b/src/ncc/Objects/ProjectConfiguration/UpdateSource/Repository.php @@ -1,90 +1,87 @@ $this->Name, - ($bytecode ? Functions::cbc('type') : 'type') => $this->Type, - ($bytecode ? Functions::cbc('host') : 'host') => $this->Host, - ($bytecode ? Functions::cbc('ssl') : 'ssl') => $this->SSL + ($bytecode ? Functions::cbc('name') : 'name') => $this->name, + ($bytecode ? Functions::cbc('type') : 'type') => $this->type, + ($bytecode ? Functions::cbc('host') : 'host') => $this->host, + ($bytecode ? Functions::cbc('ssl') : 'ssl') => $this->ssl ]; } /** - * Constructs object from an array representation - * - * @param array $data - * @return Repository + * @inheritDoc */ - public static function fromArray(array $data): self + public static function fromArray(array $data): Repository { - $obj = new self(); - $obj->Name = Functions::array_bc($data, 'name'); - $obj->Type = Functions::array_bc($data, 'type'); - $obj->Host = Functions::array_bc($data, 'host'); - $obj->SSL = Functions::array_bc($data, 'ssl'); - return $obj; + $object = new self(); + + $object->name = Functions::array_bc($data, 'name'); + $object->type = Functions::array_bc($data, 'type'); + $object->host = Functions::array_bc($data, 'host'); + $object->ssl = Functions::array_bc($data, 'ssl'); + + return $object; } } \ No newline at end of file