Completed more structure objects
This commit is contained in:
parent
b5b27f5e20
commit
bfe01fd7bc
8 changed files with 231 additions and 43 deletions
0
LICENSE
Normal file
0
LICENSE
Normal file
|
@ -36,7 +36,9 @@
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
$this->Project = new Project();
|
||||||
$this->Assembly = new Assembly();
|
$this->Assembly = new Assembly();
|
||||||
|
$this->Build = new Build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -63,7 +65,9 @@
|
||||||
public function toArray(bool $bytecode=false): array
|
public function toArray(bool $bytecode=false): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
($bytecode ? Functions::cbc('assembly') : 'assembly') => $this->Assembly->toArray($bytecode)
|
($bytecode ? Functions::cbc('project') : 'project') => $this->Project->toArray($bytecode),
|
||||||
|
($bytecode ? Functions::cbc('assembly') : 'assembly') => $this->Assembly->toArray($bytecode),
|
||||||
|
($bytecode ? Functions::cbc('build') : 'build') => $this->Build->toArray($bytecode),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/** @noinspection PhpMissingFieldTypeInspection */
|
||||||
|
|
||||||
namespace ncc\Objects\ProjectConfiguration;
|
namespace ncc\Objects\ProjectConfiguration;
|
||||||
|
|
||||||
class Build
|
class Build
|
||||||
|
@ -49,14 +51,25 @@
|
||||||
/**
|
/**
|
||||||
* An array of dependencies that are required by default
|
* An array of dependencies that are required by default
|
||||||
*
|
*
|
||||||
* @var \ncc\Objects\ProjectConfiguration\Dependency[]
|
* @var Dependency[]
|
||||||
*/
|
*/
|
||||||
public $Dependencies;
|
public $Dependencies;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An array of build configurations
|
* An array of build configurations
|
||||||
*
|
*
|
||||||
* @var \ncc\Objects\BuildConfiguration[]
|
* @var BuildConfiguration[]
|
||||||
*/
|
*/
|
||||||
public $Configurations;
|
public $Configurations;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array representation of the object
|
||||||
|
*
|
||||||
|
* @param bool $bytecode
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function toArray(bool $bytecode=false): array
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/** @noinspection PhpMissingFieldTypeInspection */
|
||||||
|
|
||||||
namespace ncc\Objects\ProjectConfiguration;
|
namespace ncc\Objects\ProjectConfiguration;
|
||||||
|
|
||||||
|
use ncc\Utilities\Functions;
|
||||||
|
|
||||||
class BuildConfiguration
|
class BuildConfiguration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -57,7 +61,7 @@
|
||||||
* Dependencies required for the build configuration, cannot conflict with the
|
* Dependencies required for the build configuration, cannot conflict with the
|
||||||
* default dependencies
|
* default dependencies
|
||||||
*
|
*
|
||||||
* @var \ncc\Objects\ProjectConfiguration\Dependency[]
|
* @var Dependency[]
|
||||||
*/
|
*/
|
||||||
public $Dependencies;
|
public $Dependencies;
|
||||||
|
|
||||||
|
@ -87,18 +91,18 @@
|
||||||
{
|
{
|
||||||
$ReturnResults = [];
|
$ReturnResults = [];
|
||||||
|
|
||||||
$ReturnResults[($bytecode ? \ncc\Utilities\Functions::cbc('name') : 'name')] = $this->Name;
|
$ReturnResults[($bytecode ? Functions::cbc('name') : 'name')] = $this->Name;
|
||||||
$ReturnResults[($bytecode ? \ncc\Utilities\Functions::cbc('options') : 'options')] = $this->Options;
|
$ReturnResults[($bytecode ? Functions::cbc('options') : 'options')] = $this->Options;
|
||||||
$ReturnResults[($bytecode ? \ncc\Utilities\Functions::cbc('static_linking') : 'static_linking')] = $this->StaticLinking;
|
$ReturnResults[($bytecode ? Functions::cbc('static_linking') : 'static_linking')] = $this->StaticLinking;
|
||||||
$ReturnResults[($bytecode ? \ncc\Utilities\Functions::cbc('output_path') : 'output_path')] = $this->OutputPath;
|
$ReturnResults[($bytecode ? Functions::cbc('output_path') : 'output_path')] = $this->OutputPath;
|
||||||
$ReturnResults[($bytecode ? \ncc\Utilities\Functions::cbc('define_constants') : 'define_constants')] = $this->DefineConstants;
|
$ReturnResults[($bytecode ? Functions::cbc('define_constants') : 'define_constants')] = $this->DefineConstants;
|
||||||
$ReturnResults[($bytecode ? \ncc\Utilities\Functions::cbc('strict_constants') : 'strict_constants')] = $this->StrictConstants;
|
$ReturnResults[($bytecode ? Functions::cbc('strict_constants') : 'strict_constants')] = $this->StrictConstants;
|
||||||
$ReturnResults[($bytecode ? \ncc\Utilities\Functions::cbc('exclude_files') : 'exclude_files')] = $this->ExcludeFiles;
|
$ReturnResults[($bytecode ? Functions::cbc('exclude_files') : 'exclude_files')] = $this->ExcludeFiles;
|
||||||
$ReturnResults[($bytecode ? \ncc\Utilities\Functions::cbc('dependencies') : 'dependencies')] = [];
|
$ReturnResults[($bytecode ? Functions::cbc('dependencies') : 'dependencies')] = [];
|
||||||
|
|
||||||
foreach($this->Dependencies as $dependency)
|
foreach($this->Dependencies as $dependency)
|
||||||
{
|
{
|
||||||
$ReturnResults[($bytecode ? \ncc\Utilities\Functions::cbc('dependencies') : 'dependencies')][] = $dependency->toArray();
|
$ReturnResults[($bytecode ? Functions::cbc('dependencies') : 'dependencies')][] = $dependency->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $ReturnResults;
|
return $ReturnResults;
|
||||||
|
@ -114,44 +118,47 @@
|
||||||
{
|
{
|
||||||
$BuildConfigurationObject = new BuildConfiguration();
|
$BuildConfigurationObject = new BuildConfiguration();
|
||||||
|
|
||||||
if(\ncc\Utilities\Functions::array_bc($data, 'name') !== null)
|
if(Functions::array_bc($data, 'name') !== null)
|
||||||
{
|
{
|
||||||
$BuildConfigurationObject = \ncc\Utilities\Functions::array_bc($data, 'name');
|
$BuildConfigurationObject->Name = Functions::array_bc($data, 'name');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(\ncc\Utilities\Functions::array_bc($data, 'options') !== null)
|
if(Functions::array_bc($data, 'options') !== null)
|
||||||
{
|
{
|
||||||
$BuildConfigurationObject = \ncc\Utilities\Functions::array_bc($data, 'options');
|
$BuildConfigurationObject->Options = Functions::array_bc($data, 'options');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(\ncc\Utilities\Functions::array_bc($data, 'static_linking') !== null)
|
if(Functions::array_bc($data, 'static_linking') !== null)
|
||||||
{
|
{
|
||||||
$BuildConfigurationObject = \ncc\Utilities\Functions::array_bc($data, 'static_linking');
|
$BuildConfigurationObject->StaticLinking = Functions::array_bc($data, 'static_linking');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(\ncc\Utilities\Functions::array_bc($data, 'output_path') !== null)
|
if(Functions::array_bc($data, 'output_path') !== null)
|
||||||
{
|
{
|
||||||
$BuildConfigurationObject = \ncc\Utilities\Functions::array_bc($data, 'output_path');
|
$BuildConfigurationObject->OutputPath = Functions::array_bc($data, 'output_path');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(\ncc\Utilities\Functions::array_bc($data, 'define_constants') !== null)
|
if(Functions::array_bc($data, 'define_constants') !== null)
|
||||||
{
|
{
|
||||||
$BuildConfigurationObject = \ncc\Utilities\Functions::array_bc($data, 'define_constants');
|
$BuildConfigurationObject->DefineConstants = Functions::array_bc($data, 'define_constants');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(\ncc\Utilities\Functions::array_bc($data, 'strict_constants') !== null)
|
if(Functions::array_bc($data, 'strict_constants') !== null)
|
||||||
{
|
{
|
||||||
$BuildConfigurationObject = \ncc\Utilities\Functions::array_bc($data, 'strict_constants');
|
$BuildConfigurationObject->StrictConstants = Functions::array_bc($data, 'strict_constants');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(\ncc\Utilities\Functions::array_bc($data, 'exclude_files') !== null)
|
if(Functions::array_bc($data, 'exclude_files') !== null)
|
||||||
{
|
{
|
||||||
$BuildConfigurationObject = \ncc\Utilities\Functions::array_bc($data, 'exclude_files');
|
$BuildConfigurationObject->ExcludeFiles = Functions::array_bc($data, 'exclude_files');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(\ncc\Utilities\Functions::array_bc($data, 'dependencies') !== null)
|
if(Functions::array_bc($data, 'dependencies') !== null)
|
||||||
{
|
{
|
||||||
$BuildConfigurationObject = \ncc\Utilities\Functions::array_bc($data, 'dependencies');
|
foreach(Functions::array_bc($data, 'dependencies') as $item)
|
||||||
|
{
|
||||||
|
$BuildConfigurationObject->Dependencies[] = Dependency::fromArray($item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $BuildConfigurationObject;
|
return $BuildConfigurationObject;
|
||||||
|
|
|
@ -1,8 +1,74 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/** @noinspection PhpMissingFieldTypeInspection */
|
||||||
|
|
||||||
namespace ncc\Objects\ProjectConfiguration;
|
namespace ncc\Objects\ProjectConfiguration;
|
||||||
|
|
||||||
|
use ncc\Utilities\Functions;
|
||||||
|
|
||||||
class Compiler
|
class Compiler
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* The compiler extension that the project uses
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $Extension;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The minimum version that is supported
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $MinimumVersion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The maximum version that is supported
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $MaximumVersion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array representation of the object
|
||||||
|
*
|
||||||
|
* @param bool $bytecode
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function toArray(bool $bytecode=false): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
($bytecode ? Functions::cbc('extension') : 'extension') => $this->Extension,
|
||||||
|
($bytecode ? Functions::cbc('minimum_version') : 'minimum_version') => $this->MinimumVersion,
|
||||||
|
($bytecode ? Functions::cbc('maximum_version') : 'maximum_version') => $this->MaximumVersion
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs object from an array representation
|
||||||
|
*
|
||||||
|
* @param array $data
|
||||||
|
* @return Compiler
|
||||||
|
*/
|
||||||
|
public static function fromArray(array $data): Compiler
|
||||||
|
{
|
||||||
|
$CompilerObject = new Compiler();
|
||||||
|
|
||||||
|
if(Functions::array_bc($data, 'extension') !== null)
|
||||||
|
{
|
||||||
|
$CompilerObject->Extension = Functions::array_bc($data, 'extension');
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Functions::array_bc($data, 'maximum_version') !== null)
|
||||||
|
{
|
||||||
|
$CompilerObject->MaximumVersion = Functions::array_bc($data, 'maximum_version');
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Functions::array_bc($data, 'minimum_version') !== null)
|
||||||
|
{
|
||||||
|
$CompilerObject->MinimumVersion = Functions::array_bc($data, 'minimum_version');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $CompilerObject;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/** @noinspection PhpMissingFieldTypeInspection */
|
||||||
|
|
||||||
namespace ncc\Objects\ProjectConfiguration;
|
namespace ncc\Objects\ProjectConfiguration;
|
||||||
|
|
||||||
|
use ncc\Utilities\Functions;
|
||||||
|
|
||||||
class Dependency
|
class Dependency
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -30,22 +34,23 @@
|
||||||
/**
|
/**
|
||||||
* Returns an array representation of the object
|
* Returns an array representation of the object
|
||||||
*
|
*
|
||||||
|
* @param bool $bytecode
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function toArray(bool $bytecode=false): array
|
public function toArray(bool $bytecode=false): array
|
||||||
{
|
{
|
||||||
$ReturnResults = [];
|
$ReturnResults = [];
|
||||||
|
|
||||||
$ReturnResults[($bytecode ? \ncc\Utilities\Functions::cbc('name') : 'name')] = $this->Name;
|
$ReturnResults[($bytecode ? Functions::cbc('name') : 'name')] = $this->Name;
|
||||||
|
|
||||||
if($this->Source !== null && strlen($this->Source) > 0)
|
if($this->Source !== null && strlen($this->Source) > 0)
|
||||||
{
|
{
|
||||||
$ReturnResults[($bytecode ? \ncc\Utilities\Functions::cbc('source') : 'source')] = $this->Source;
|
$ReturnResults[($bytecode ? Functions::cbc('source') : 'source')] = $this->Source;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->Version !== null && strlen($this->Version) > 0)
|
if($this->Version !== null && strlen($this->Version) > 0)
|
||||||
{
|
{
|
||||||
$ReturnResults[($bytecode ? \ncc\Utilities\Functions::cbc('version') : 'version')] = $this->Version;
|
$ReturnResults[($bytecode ? Functions::cbc('version') : 'version')] = $this->Version;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $ReturnResults;
|
return $ReturnResults;
|
||||||
|
@ -61,9 +66,9 @@
|
||||||
{
|
{
|
||||||
$DependencyObject = new Dependency();
|
$DependencyObject = new Dependency();
|
||||||
|
|
||||||
$DependencyObject->Name = \ncc\Utilities\Functions::array_bc($data, 'name');
|
$DependencyObject->Name = Functions::array_bc($data, 'name');
|
||||||
$DependencyObject->Source = \ncc\Utilities\Functions::array_bc($data, 'source');
|
$DependencyObject->Source = Functions::array_bc($data, 'source');
|
||||||
$DependencyObject->Version = \ncc\Utilities\Functions::array_bc($data, 'version');
|
$DependencyObject->Version = Functions::array_bc($data, 'version');
|
||||||
|
|
||||||
return $DependencyObject;
|
return $DependencyObject;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,68 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/** @noinspection PhpMissingFieldTypeInspection */
|
||||||
|
|
||||||
namespace ncc\Objects\ProjectConfiguration;
|
namespace ncc\Objects\ProjectConfiguration;
|
||||||
|
|
||||||
|
use ncc\Utilities\Functions;
|
||||||
|
|
||||||
class Project
|
class Project
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var Compiler
|
||||||
|
*/
|
||||||
|
public $Compiler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $Options;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Public Constructor
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->Compiler = new Compiler();
|
||||||
|
$this->Options = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array representation of the object
|
||||||
|
*
|
||||||
|
* @param bool $bytecode
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function toArray(bool $bytecode=false): array
|
||||||
|
{
|
||||||
|
$ReturnResults = [];
|
||||||
|
|
||||||
|
$ReturnResults[($bytecode ? Functions::cbc('compiler') : 'compiler')] = $this->Compiler->toArray($bytecode);
|
||||||
|
$ReturnResults[($bytecode ? Functions::cbc('options') : 'options')] = $this->Options;
|
||||||
|
|
||||||
|
return $ReturnResults;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs the object from an array representation
|
||||||
|
*
|
||||||
|
* @param array $data
|
||||||
|
* @return Project
|
||||||
|
*/
|
||||||
|
public static function fromArray(array $data): Project
|
||||||
|
{
|
||||||
|
$ProjectObject = new Project();
|
||||||
|
|
||||||
|
if(Functions::array_bc($data, 'compiler') !== null)
|
||||||
|
{
|
||||||
|
$ProjectObject->Compiler = Compiler::fromArray(Functions::array_bc($data, 'compiler'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Functions::array_bc($data, 'options') !== null)
|
||||||
|
{
|
||||||
|
$ProjectObject->Options = Functions::array_bc($data, 'options');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ProjectObject;
|
||||||
|
}
|
||||||
}
|
}
|
33
src/ncc/autoload.php
Normal file
33
src/ncc/autoload.php
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
// @codingStandardsIgnoreFile
|
||||||
|
// @codeCoverageIgnoreStart
|
||||||
|
// this is an autogenerated file - do not edit
|
||||||
|
spl_autoload_register(
|
||||||
|
function($class) {
|
||||||
|
static $classes = null;
|
||||||
|
if ($classes === null) {
|
||||||
|
$classes = array(
|
||||||
|
'ncc\\abstracts\\exceptioncodes' => '/Abstracts/ExceptionCodes.php',
|
||||||
|
'ncc\\abstracts\\regexpatterns' => '/Abstracts/RegexPatterns.php',
|
||||||
|
'ncc\\exceptions\\invalidprojectconfigurationexception' => '/Exceptions/InvalidProjectConfigurationException.php',
|
||||||
|
'ncc\\ncc' => '/ncc.php',
|
||||||
|
'ncc\\objects\\projectconfiguration' => '/Objects/ProjectConfiguration.php',
|
||||||
|
'ncc\\objects\\projectconfiguration\\assembly' => '/Objects/ProjectConfiguration/Assembly.php',
|
||||||
|
'ncc\\objects\\projectconfiguration\\build' => '/Objects/ProjectConfiguration/Build.php',
|
||||||
|
'ncc\\objects\\projectconfiguration\\buildconfiguration' => '/Objects/ProjectConfiguration/BuildConfiguration.php',
|
||||||
|
'ncc\\objects\\projectconfiguration\\compiler' => '/Objects/ProjectConfiguration/Compiler.php',
|
||||||
|
'ncc\\objects\\projectconfiguration\\dependency' => '/Objects/ProjectConfiguration/Dependency.php',
|
||||||
|
'ncc\\objects\\projectconfiguration\\project' => '/Objects/ProjectConfiguration/Project.php',
|
||||||
|
'ncc\\utilities\\functions' => '/Utilities/Functions.php',
|
||||||
|
'ncc\\utilities\\validate' => '/Utilities/Validate.php'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$cn = strtolower($class);
|
||||||
|
if (isset($classes[$cn])) {
|
||||||
|
require __DIR__ . $classes[$cn];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
true,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
// @codeCoverageIgnoreEnd
|
Loading…
Add table
Reference in a new issue