vendor/shopware/core/Checkout/Cart/Tax/Struct/TaxRule.php line 10

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Checkout\Cart\Tax\Struct;
  3. use Shopware\Core\Framework\Struct\Struct;
  4. use Shopware\Core\Framework\Util\FloatComparator;
  5. use Symfony\Component\Validator\Constraints\NotBlank;
  6. use Symfony\Component\Validator\Constraints\Type;
  7. class TaxRule extends Struct
  8. {
  9.     /**
  10.      * @var float
  11.      */
  12.     protected $taxRate;
  13.     /**
  14.      * @var float
  15.      */
  16.     protected $percentage;
  17.     public function __construct(float $taxRatefloat $percentage 100.0)
  18.     {
  19.         $this->taxRate FloatComparator::cast($taxRate);
  20.         $this->percentage FloatComparator::cast($percentage);
  21.     }
  22.     public function getTaxRate(): float
  23.     {
  24.         return FloatComparator::cast($this->taxRate);
  25.     }
  26.     public function getPercentage(): float
  27.     {
  28.         return FloatComparator::cast($this->percentage);
  29.     }
  30.     public static function getConstraints(): array
  31.     {
  32.         return [
  33.             'taxRate' => [new NotBlank(), new Type('numeric')],
  34.             'percentage' => [new Type('numeric')],
  35.         ];
  36.     }
  37.     public function getApiAlias(): string
  38.     {
  39.         return 'cart_tax_rule';
  40.     }
  41. }