id = (int)$data['id']; $obj->scanJobId = $data['scan_job_id'] !== null ? (int)$data['scan_job_id'] : null; $obj->ipAddress = $data['ip_address']; $obj->macAddress = $data['mac_address'] ?? null; $obj->hostname = $data['hostname'] ?? null; $obj->vendor = $data['vendor'] ?? null; $obj->detectedOs = $data['detected_os'] ?? null; $obj->openPorts = json_decode($data['open_ports_json'] ?? '[]', true); $obj->protocols = json_decode($data['protocols_json'] ?? '[]', true); $obj->fingerprint = json_decode($data['fingerprint_json'] ?? '{}', true); $obj->confidence = (int)$data['confidence']; $obj->status = $data['status']; $obj->matchedDeviceId = $data['matched_device_id'] ?? null; $obj->firstSeen = new \DateTimeImmutable($data['first_seen']); $obj->lastSeen = new \DateTimeImmutable($data['last_seen']); $obj->createdAt = new \DateTimeImmutable($data['created_at']); $obj->updatedAt = new \DateTimeImmutable($data['updated_at']); return $obj; } }