vendor/shopware/core/Framework/DataAbstractionLayer/Pricing/Price.php line 7

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Framework\DataAbstractionLayer\Pricing;
  3. use Shopware\Core\Framework\Struct\Struct;
  4. class Price extends Struct
  5. {
  6.     /**
  7.      * @var string
  8.      */
  9.     protected $currencyId;
  10.     /**
  11.      * @var float
  12.      */
  13.     protected $net;
  14.     /**
  15.      * @var float
  16.      */
  17.     protected $gross;
  18.     /**
  19.      * @var bool
  20.      */
  21.     protected $linked;
  22.     /**
  23.      * @var Price|null
  24.      */
  25.     protected $listPrice;
  26.     public function __construct(string $currencyIdfloat $netfloat $grossbool $linked, ?Price $listPrice null)
  27.     {
  28.         $this->net $net;
  29.         $this->gross $gross;
  30.         $this->linked $linked;
  31.         $this->currencyId $currencyId;
  32.         $this->listPrice $listPrice;
  33.     }
  34.     public function getNet(): float
  35.     {
  36.         return (float) $this->net;
  37.     }
  38.     public function setNet(float $net): void
  39.     {
  40.         $this->net $net;
  41.     }
  42.     public function getGross(): float
  43.     {
  44.         return (float) $this->gross;
  45.     }
  46.     public function setGross(float $gross): void
  47.     {
  48.         $this->gross $gross;
  49.     }
  50.     public function getLinked(): bool
  51.     {
  52.         return $this->linked;
  53.     }
  54.     public function setLinked(bool $linked): void
  55.     {
  56.         $this->linked $linked;
  57.     }
  58.     public function add(self $price): void
  59.     {
  60.         $this->gross += $price->getGross();
  61.         $this->net += $price->getNet();
  62.     }
  63.     public function getCurrencyId(): string
  64.     {
  65.         return $this->currencyId;
  66.     }
  67.     public function setCurrencyId(string $currencyId): void
  68.     {
  69.         $this->currencyId $currencyId;
  70.     }
  71.     public function setListPrice(?Price $listPrice): void
  72.     {
  73.         $this->listPrice $listPrice;
  74.     }
  75.     public function getListPrice(): ?Price
  76.     {
  77.         return $this->listPrice;
  78.     }
  79.     public function getApiAlias(): string
  80.     {
  81.         return 'price';
  82.     }
  83. }