trafficmonitor/app/DTOs/TrafficDTO.php
2025-11-10 16:34:21 +09:00

36 lines
738 B
PHP

<?php
namespace App\DTOs;
class TrafficDTO extends CommonDTO
{
public ?int $uid = null;
public ?string $client = null;
public ?string $switch = null;
public ?string $ip = null;
public ?string $interface = null;
public ?int $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,
'switch' => $this->switch,
'ip' => $this->ip,
'interface' => $this->interface,
'status' => $this->status,
];
}
}