id = $data['id'] ?? null; $dto->name = $data['name'] ?? null; $dto->slug = $data['slug'] ?? null; $dto->createdAt = isset($data['createdAt']) ? (int)$data['createdAt'] : null; return $dto; } /** * Convert DTO to array * * @return array */ public function toArray(): array { return [ 'id' => $this->id, 'name' => $this->name, 'slug' => $this->slug, 'createdAt' => $this->createdAt, ]; } }