quantity < 1 ) { throw new DomainException( 'pricing.extra_quantity', 'Extra quantity must be at least 1.' ); } if ( $this->unit_price->is_negative() ) { throw new DomainException( 'pricing.extra_price_negative', 'Extra unit price must not be negative.' ); } } /** * Unit price. * * @since 0.1.0 */ public function unit_price(): Money { return $this->unit_price; } /** * Quantity. * * @since 0.1.0 */ public function quantity(): int { return $this->quantity; } /** * Line total. * * @since 0.1.0 */ public function line_total(): Money { return $this->unit_price->multiply( $this->quantity ); } }