*/ final class DnsRecord { private $name; private $type; private $value; private $priority; private $valid; private $cached; public static function create(array $data): self { $model = new self(); $model->name = $data['name'] ?? null; $model->type = $data['record_type'] ?? null; $model->value = $data['value'] ?? null; $model->priority = $data['priority'] ?? null; $model->valid = $data['valid'] ?? null; $model->cached = $data['cached'] ?? []; return $model; } private function __construct() { } /** * name of the record, as used in CNAME, etc. */ public function getName(): ?string { return $this->name; } /** * DNS record type. * * @return string */ public function getType(): ?string { return $this->type; } /** * DNS record value. */ public function getValue(): ?string { return $this->value; } /** * Record priority, used for MX. */ public function getPriority(): ?string { return $this->priority; } /** * DNS record has been added to domain DNS? */ public function isValid(): bool { return 'valid' === $this->valid; } public function getValidity(): ?string { return $this->valid; } /** * DNS record current value. */ public function getCached(): array { return $this->cached; } }