vendor/shopware/core/Checkout/Cart/Tax/Struct/CalculatedTax.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\Log\Package;
  4. use Shopware\Core\Framework\Struct\Struct;
  5. use Shopware\Core\Framework\Util\FloatComparator;
  6. #[Package('checkout')]
  7. class CalculatedTax extends Struct
  8. {
  9.     /**
  10.      * @var float
  11.      */
  12.     protected $tax 0;
  13.     /**
  14.      * @var float
  15.      */
  16.     protected $taxRate;
  17.     /**
  18.      * @var float
  19.      */
  20.     protected $price 0;
  21.     public function __construct(float $taxfloat $taxRatefloat $price)
  22.     {
  23.         $this->tax FloatComparator::cast($tax);
  24.         $this->taxRate FloatComparator::cast($taxRate);
  25.         $this->price FloatComparator::cast($price);
  26.     }
  27.     public function getTax(): float
  28.     {
  29.         return $this->tax;
  30.     }
  31.     public function setTax(float $tax): void
  32.     {
  33.         $this->tax FloatComparator::cast($tax);
  34.     }
  35.     public function getTaxRate(): float
  36.     {
  37.         return $this->taxRate;
  38.     }
  39.     public function getPrice(): float
  40.     {
  41.         return $this->price;
  42.     }
  43.     public function increment(self $calculatedTax): void
  44.     {
  45.         $this->tax FloatComparator::cast($this->tax $calculatedTax->getTax());
  46.         $this->price FloatComparator::cast($this->price $calculatedTax->getPrice());
  47.     }
  48.     public function setPrice(float $price): void
  49.     {
  50.         $this->price FloatComparator::cast($price);
  51.     }
  52.     public function getApiAlias(): string
  53.     {
  54.         return 'cart_tax_calculated';
  55.     }
  56. }