commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
HighPrecisionMoneyModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
15 use stdClass;
16 
21 {
22  public const DISCRIMINATOR_VALUE = 'highPrecision';
27  protected $type;
28 
33  protected $fractionDigits;
34 
39  protected $centAmount;
40 
45  protected $currencyCode;
46 
51  protected $preciseAmount;
52 
53 
57  public function __construct(
58  ?int $fractionDigits = null,
59  ?int $centAmount = null,
60  ?string $currencyCode = null,
61  ?int $preciseAmount = null,
62  ?string $type = null
63  ) {
64  $this->fractionDigits = $fractionDigits;
65  $this->centAmount = $centAmount;
66  $this->currencyCode = $currencyCode;
67  $this->preciseAmount = $preciseAmount;
68  $this->type = $type ?? self::DISCRIMINATOR_VALUE;
69  }
70 
75  public function getType()
76  {
77  if (is_null($this->type)) {
79  $data = $this->raw(self::FIELD_TYPE);
80  if (is_null($data)) {
81  return null;
82  }
83  $this->type = (string) $data;
84  }
85 
86  return $this->type;
87  }
88 
93  public function getFractionDigits()
94  {
95  if (is_null($this->fractionDigits)) {
97  $data = $this->raw(self::FIELD_FRACTION_DIGITS);
98  if (is_null($data)) {
99  return null;
100  }
101  $this->fractionDigits = (int) $data;
102  }
103 
104  return $this->fractionDigits;
105  }
106 
111  public function getCentAmount()
112  {
113  if (is_null($this->centAmount)) {
115  $data = $this->raw(self::FIELD_CENT_AMOUNT);
116  if (is_null($data)) {
117  return null;
118  }
119  $this->centAmount = (int) $data;
120  }
121 
122  return $this->centAmount;
123  }
124 
131  public function getCurrencyCode()
132  {
133  if (is_null($this->currencyCode)) {
135  $data = $this->raw(self::FIELD_CURRENCY_CODE);
136  if (is_null($data)) {
137  return null;
138  }
139  $this->currencyCode = (string) $data;
140  }
141 
142  return $this->currencyCode;
143  }
144 
149  public function getPreciseAmount()
150  {
151  if (is_null($this->preciseAmount)) {
153  $data = $this->raw(self::FIELD_PRECISE_AMOUNT);
154  if (is_null($data)) {
155  return null;
156  }
157  $this->preciseAmount = (int) $data;
158  }
159 
160  return $this->preciseAmount;
161  }
162 
163 
167  public function setFractionDigits(?int $fractionDigits): void
168  {
169  $this->fractionDigits = $fractionDigits;
170  }
171 
175  public function setCentAmount(?int $centAmount): void
176  {
177  $this->centAmount = $centAmount;
178  }
179 
183  public function setCurrencyCode(?string $currencyCode): void
184  {
185  $this->currencyCode = $currencyCode;
186  }
187 
191  public function setPreciseAmount(?int $preciseAmount): void
192  {
193  $this->preciseAmount = $preciseAmount;
194  }
195 }
__construct(?int $fractionDigits=null, ?int $centAmount=null, ?string $currencyCode=null, ?int $preciseAmount=null, ?string $type=null)