28 lines
720 B
PHP
28 lines
720 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Domovoy\Models;
|
|
|
|
class NetworkRange
|
|
{
|
|
public ?int $id = null;
|
|
public string $name = '';
|
|
public string $cidr = '';
|
|
public bool $enabled = true;
|
|
public ?\DateTimeImmutable $createdAt = null;
|
|
public ?\DateTimeImmutable $updatedAt = null;
|
|
|
|
public static function fromArray(array $data): self
|
|
{
|
|
$obj = new self();
|
|
$obj->id = (int)$data['id'];
|
|
$obj->name = $data['name'];
|
|
$obj->cidr = $data['cidr'];
|
|
$obj->enabled = (bool)$data['enabled'];
|
|
$obj->createdAt = new \DateTimeImmutable($data['created_at']);
|
|
$obj->updatedAt = new \DateTimeImmutable($data['updated_at']);
|
|
return $obj;
|
|
}
|
|
}
|