color === Constants::DEFAULT_COLOR) { return null; } return $this->color; } public function hasColor(): bool { return null !== $this->color && $this->color !== Constants::DEFAULT_COLOR; } public function setColor(?string $color = null): void { $this->color = $color; } abstract public function getName(): ?string; /** * Internal value: this color will never be empty and is generated by the tag name if not set explicit. */ #[Serializer\VirtualProperty] #[Serializer\SerializedName('color')] #[Serializer\Groups(['Default'])] public function getColorSafe(): string { return $this->getColor() ?? (new Color())->getRandom($this->getName()); } }