tax_class ); if ( '' === $tax_class ) { throw new DomainException( 'tax.class_empty', 'Tax class must not be empty.' ); } $this->tax_class = $tax_class; if ( $this->percent < 0 || $this->percent > 100 ) { throw new DomainException( 'tax.percent_range', 'Tax percent must be between 0 and 100 inclusive.' ); } } /** * Zero-rate helper. * * @param string $tax_class Tax class key. * @param bool $inclusive Inclusive flag. * * @since 0.1.0 */ public static function zero( string $tax_class = 'zero', bool $inclusive = false ): self { return new self( $tax_class, 0, $inclusive ); } /** * Tax class key. * * @since 0.1.0 */ public function tax_class(): string { return $this->tax_class; } /** * Percent 0–100. * * @since 0.1.0 */ public function percent(): int { return $this->percent; } /** * Whether prices are tax-inclusive. * * @since 0.1.0 */ public function is_inclusive(): bool { return $this->inclusive; } }