showBrand = $showBrand; $this->showDescription = $showDescription; $this->showPrice = $showPrice; $this->showProviderBadge = $showProviderBadge; } /** * Construct a meta-flags view with the canonical "frontend * defaults" combination. * * Convenience factory for the §8.2 baseline so call sites do * not have to spell out the four canonical default values. * Returns a view with `showBrand = true`, * `showDescription = true`, `showPrice = true`, and * `showProviderBadge = false` — the §8.2 example structure's * `meta` slot, verbatim. */ public static function defaults(): self { return new self( true, true, true, false ); } /** * Whether the §10.2 brand region renders. */ public function showBrand(): bool { return $this->showBrand; } /** * Whether the §10.3 description region renders. */ public function showDescription(): bool { return $this->showDescription; } /** * Whether the §10.5 price region renders. */ public function showPrice(): bool { return $this->showPrice; } /** * Whether the §8.2 provider badge entry renders. */ public function showProviderBadge(): bool { return $this->showProviderBadge; } /** * Produce a copy of this view with `showBrand` replaced. * * @param bool $showBrand New brand-visibility flag. */ public function withShowBrand( bool $showBrand ): self { $clone = clone $this; $clone->showBrand = $showBrand; return $clone; } /** * Produce a copy of this view with `showDescription` replaced. * * @param bool $showDescription New description-visibility flag. */ public function withShowDescription( bool $showDescription ): self { $clone = clone $this; $clone->showDescription = $showDescription; return $clone; } /** * Produce a copy of this view with `showPrice` replaced. * * @param bool $showPrice New price-visibility flag. */ public function withShowPrice( bool $showPrice ): self { $clone = clone $this; $clone->showPrice = $showPrice; return $clone; } /** * Produce a copy of this view with `showProviderBadge` * replaced. * * @param bool $showProviderBadge New provider-badge-visibility flag. */ public function withShowProviderBadge( bool $showProviderBadge ): self { $clone = clone $this; $clone->showProviderBadge = $showProviderBadge; return $clone; } /** * Report whether this view equals the supplied one. * * Equality is structural: every flag must match with strict * comparison. * * @param self $other Other view to compare against. */ public function equals( self $other ): bool { return $this->showBrand === $other->showBrand && $this->showDescription === $other->showDescription && $this->showPrice === $other->showPrice && $this->showProviderBadge === $other->showProviderBadge; } }