commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
HighPrecisionMoneyBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
16 use stdClass;
17 
21 final class HighPrecisionMoneyBuilder implements Builder
22 {
27  private $fractionDigits;
28 
33  private $centAmount;
34 
39  private $currencyCode;
40 
45  private $preciseAmount;
46 
51  public function getFractionDigits()
52  {
53  return $this->fractionDigits;
54  }
55 
60  public function getCentAmount()
61  {
62  return $this->centAmount;
63  }
64 
71  public function getCurrencyCode()
72  {
73  return $this->currencyCode;
74  }
75 
80  public function getPreciseAmount()
81  {
82  return $this->preciseAmount;
83  }
84 
89  public function withFractionDigits(?int $fractionDigits)
90  {
91  $this->fractionDigits = $fractionDigits;
92 
93  return $this;
94  }
95 
100  public function withCentAmount(?int $centAmount)
101  {
102  $this->centAmount = $centAmount;
103 
104  return $this;
105  }
106 
111  public function withCurrencyCode(?string $currencyCode)
112  {
113  $this->currencyCode = $currencyCode;
114 
115  return $this;
116  }
117 
122  public function withPreciseAmount(?int $preciseAmount)
123  {
124  $this->preciseAmount = $preciseAmount;
125 
126  return $this;
127  }
128 
129 
130  public function build(): HighPrecisionMoney
131  {
132  return new HighPrecisionMoneyModel(
133  $this->fractionDigits,
134  $this->centAmount,
135  $this->currencyCode,
136  $this->preciseAmount
137  );
138  }
139 
140  public static function of(): HighPrecisionMoneyBuilder
141  {
142  return new self();
143  }
144 }