1.0.0 Alpha Release #59

Merged
netkas merged 213 commits from v1.0.0_alpha into master 2023-01-29 23:27:58 +00:00
Showing only changes of commit b4acfaa0cb - Show all commits

View file

@ -1,8 +1,58 @@
<?php <?php
/** @noinspection PhpMissingFieldTypeInspection */
namespace ncc\Objects\ProjectConfiguration; namespace ncc\Objects\ProjectConfiguration;
use ncc\Objects\ProjectConfiguration\UpdateSource\Repository;
use ncc\Utilities\Functions;
class UpdateSource class UpdateSource
{ {
public $type; /**
* The string format of where the source is located.
*
* @var string
*/
public $Source;
/**
* The repository to use for the source
*
* @var Repository|null
*/
public $Repository;
/**
* Returns an array representation of the object
*
* @param bool $bytecode
* @return array
*/
public function toArray(bool $bytecode=false): array
{
return [
($bytecode ? Functions::cbc('source') : 'source') => $this->Source,
($bytecode ? Functions::cbc('repository') : 'repository') => ($this->Repository?->toArray($bytecode))
];
}
/**
* Constructs object from an array representation
*
* @param array $data
* @return UpdateSource
*/
public static function fromArray(array $data): UpdateSource
{
$obj = new UpdateSource();
$obj->Source = Functions::array_bc($data, 'source');
$obj->Repository = Functions::array_bc($data, 'repository');
if($obj->Repository !== null)
$obj->Repository = Repository::fromArray($obj->Repository);
return $obj;
}
} }