Updated \ncc\Objects\ProjectConfiguration > Build
This commit is contained in:
parent
294b3ac144
commit
954cf0fd11
1 changed files with 72 additions and 0 deletions
|
@ -4,6 +4,8 @@
|
|||
|
||||
namespace ncc\Objects\ProjectConfiguration;
|
||||
|
||||
use ncc\Utilities\Functions;
|
||||
|
||||
class Build
|
||||
{
|
||||
/**
|
||||
|
@ -62,6 +64,18 @@
|
|||
*/
|
||||
public $Configurations;
|
||||
|
||||
/**
|
||||
* Public Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->ExcludeFiles = [];
|
||||
$this->Options = [];
|
||||
$this->DefineConstants = [];
|
||||
$this->Dependencies = [];
|
||||
$this->Configurations = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array representation of the object
|
||||
*
|
||||
|
@ -70,6 +84,64 @@
|
|||
*/
|
||||
public function toArray(bool $bytecode=false): array
|
||||
{
|
||||
$ReturnResults = [];
|
||||
|
||||
$ReturnResults[($bytecode ? Functions::cbc('source_path') : 'source_path')] = $this->SourcePath;
|
||||
$ReturnResults[($bytecode ? Functions::cbc('default_configuration') : 'default_configuration')] = $this->DefaultConfiguration;
|
||||
$ReturnResults[($bytecode ? Functions::cbc('exclude_files') : 'exclude_files')] = $this->ExcludeFiles;
|
||||
$ReturnResults[($bytecode ? Functions::cbc('options') : 'options')] = $this->Options;
|
||||
$ReturnResults[($bytecode ? Functions::cbc('scope') : 'scope')] = $this->Scope;
|
||||
$ReturnResults[($bytecode ? Functions::cbc('define_constants') : 'define_constants')] = $this->DefineConstants;
|
||||
$ReturnResults[($bytecode ? Functions::cbc('dependencies') : 'dependencies')] = [];
|
||||
|
||||
foreach($this->Dependencies as $dependency)
|
||||
{
|
||||
$ReturnResults[($bytecode ? Functions::cbc('dependencies') : 'dependencies')][] = $dependency->toArray($bytecode);
|
||||
}
|
||||
|
||||
$ReturnResults[($bytecode ? Functions::cbc('configurations') : 'configurations')] = [];
|
||||
|
||||
foreach($this->Configurations as $configuration)
|
||||
{
|
||||
$ReturnResults[($bytecode ? Functions::cbc('configurations') : 'configurations')][] = $configuration->toArray($bytecode);
|
||||
}
|
||||
|
||||
return $ReturnResults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array
|
||||
*
|
||||
* @param array $data
|
||||
* @return Build
|
||||
*/
|
||||
public static function fromArray(array $data): Build
|
||||
{
|
||||
$BuildObject = new Build();
|
||||
|
||||
$BuildObject->SourcePath = Functions::array_bc($data, 'source_path');
|
||||
$BuildObject->DefaultConfiguration = Functions::array_bc($data, 'default_configuration');
|
||||
$BuildObject->ExcludeFiles = (Functions::array_bc($data, 'exclude_files') ?? []);
|
||||
$BuildObject->Options = (Functions::array_bc($data, 'options') ?? []);
|
||||
$BuildObject->Scope = Functions::array_bc($data, 'scope');
|
||||
$BuildObject->DefineConstants = (Functions::array_bc($data, 'define_constants') ?? []);
|
||||
|
||||
if(Functions::array_bc($data, 'dependencies') !== null)
|
||||
{
|
||||
foreach(Functions::array_bc($data, 'dependencies') as $dependency)
|
||||
{
|
||||
$BuildObject->Dependencies[] = Dependency::fromArray($dependency);
|
||||
}
|
||||
}
|
||||
|
||||
if(Functions::array_bc($data, 'configurations') !== null)
|
||||
{
|
||||
foreach(Functions::array_bc($data, 'configurations') as $configuration)
|
||||
{
|
||||
$BuildObject->Configurations[] = BuildConfiguration::fromArray($configuration);
|
||||
}
|
||||
}
|
||||
|
||||
return $BuildObject;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue