name)) { throw new ValidationException('El nombre del snippet es requerido'); } if (strlen($this->name) > 100) { throw new ValidationException('El nombre no puede exceder 100 caracteres'); } // CSS ya validado en Value Object CSSCode } /** * Convierte a array para persistencia */ public function toArray(): array { return [ 'id' => $this->id->value(), 'name' => $this->name, 'description' => $this->description, 'css' => $this->css->value(), 'type' => $this->loadType->value(), 'pages' => $this->pages, 'enabled' => $this->enabled, 'order' => $this->order, ]; } // Getters public function id(): SnippetId { return $this->id; } public function name(): string { return $this->name; } public function css(): CSSCode { return $this->css; } public function loadType(): LoadType { return $this->loadType; } public function pages(): array { return $this->pages; } public function isEnabled(): bool { return $this->enabled; } public function order(): int { return $this->order; } }