dbmsv4/app/Entities/Equipment/ServerEntity.php
2026-01-29 17:06:25 +09:00

91 lines
2.3 KiB
PHP

<?php
namespace App\Entities\Equipment;
use App\Models\Equipment\ServerModel;
class ServerEntity extends EquipmentEntity
{
const PK = ServerModel::PK;
const TITLE = ServerModel::TITLE;
protected $attributes = [
'user_uid' => null,
'clientinfo_uid' => null,
'serviceinfo_uid' => null,
'chassisinfo_uid' => null,
'switchinfo_uid' => null,
'code' => '',
'title' => '',
'type' => '',
'ip' => '',
'viewer' => '',
'os' => '',
'price' => 0,
'manufactur_at' => '',
'format_at' => '',
'status' => '',
];
public function __construct(array|null $data = null)
{
parent::__construct($data);
}
final public function getClientInfoUid(): int|null
{
$val = $this->clientinfo_uid ?? null;
return ($val === '' || $val === null) ? null : (int) $val;
}
final public function getServiceInfoUid(): int|null
{
$val = $this->serviceinfo_uid ?? null;
return ($val === '' || $val === null) ? null : (int) $val;
}
final public function getChassisInfoUid(): int|null
{
$val = $this->chassisinfo_uid ?? null;
return ($val === '' || $val === null) ? null : (int) $val;
}
final public function getSwitchInfoUid(): int|null
{
$val = $this->switchinfo_uid ?? null;
return ($val === '' || $val === null) ? null : (int) $val;
}
//기본기능용
public function getCustomTitle(mixed $title = null): string
{
return sprintf("[%s]%s", $this->getCode(), $title ? $title : $this->getIP());
}
final public function getCode(): string
{
return $this->code ?? null;
}
public function getType(): string
{
return $this->type ?? null;
}
public function getIP(): string
{
return $this->ip ?? '';
}
public function getViewer(): string
{
return $this->viewer ?? '';
}
public function getOS(): string
{
return $this->os ?? '';
}
public function getPrice(): int
{
return $this->price ?? 0;
}
public function getManufacturAt(): string
{
return $this->manufactur_at ?? '';
}
public function getFormatAt(): string
{
return $this->format_at ?? '';
}
}