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 54b733caf7 - Show all commits

View file

@ -0,0 +1,70 @@
<?php
/** @noinspection PhpMissingFieldTypeInspection */
namespace ncc\Objects\ProjectConfiguration\UpdateSource;
use ncc\Utilities\Functions;
class Repository
{
/**
* The name of the remote source to add
*
* @var string
*/
public $Name;
/**
* The type of client that is used to connect to the remote source
*
* @var string|null
*/
public $Type;
/**
* The host of the remote source
*
* @var string
*/
public $Host;
/**
* If SSL should be used
*
* @var bool
*/
public $SSL;
/**
* Returns an array representation of the object
*
* @param bool $bytecode
* @return array
*/
public function toArray(bool $bytecode=false): array
{
return [
($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
*/
public static function fromArray(array $data): self
{
$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;
}
}