40 lines
886 B
PHP
40 lines
886 B
PHP
<?php
|
|
|
|
namespace App\DTOs;
|
|
|
|
class TrafficDTO extends CommonDTO
|
|
{
|
|
public ?int $uid = null;
|
|
public ?string $client = null;
|
|
public ?string $server = null;
|
|
public ?string $server_ip = null;
|
|
public ?string $switch = null;
|
|
public ?string $ip = null;
|
|
public ?string $interface = null;
|
|
public ?string $status = null;
|
|
|
|
public function __construct(array $datas = [])
|
|
{
|
|
parent::__construct();
|
|
foreach ($datas as $key => $value) {
|
|
if (property_exists($this, $key)) {
|
|
$this->{$key} = $value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public function toArray(): array
|
|
{
|
|
return [
|
|
'uid' => $this->uid,
|
|
'client' => $this->client,
|
|
'server' => $this->server,
|
|
'server_ip' => $this->server_ip,
|
|
'switch' => $this->switch,
|
|
'ip' => $this->ip,
|
|
'interface' => $this->interface,
|
|
'status' => $this->status,
|
|
];
|
|
}
|
|
}
|