commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
CentPrecisionMoneyModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
15 use stdClass;
16 
21 {
22  public const DISCRIMINATOR_VALUE = 'centPrecision';
27  protected $centAmount;
28 
33  protected $currencyCode;
34 
39  protected $type;
40 
45  protected $fractionDigits;
46 
47 
51  public function __construct(
52  ?int $centAmount = null,
53  ?string $currencyCode = null,
54  ?int $fractionDigits = null,
55  ?string $type = null
56  ) {
57  $this->centAmount = $centAmount;
58  $this->currencyCode = $currencyCode;
59  $this->fractionDigits = $fractionDigits;
60  $this->type = $type ?? self::DISCRIMINATOR_VALUE;
61  }
62 
73  public function getCentAmount()
74  {
75  if (is_null($this->centAmount)) {
77  $data = $this->raw(self::FIELD_CENT_AMOUNT);
78  if (is_null($data)) {
79  return null;
80  }
81  $this->centAmount = (int) $data;
82  }
83 
84  return $this->centAmount;
85  }
86 
93  public function getCurrencyCode()
94  {
95  if (is_null($this->currencyCode)) {
97  $data = $this->raw(self::FIELD_CURRENCY_CODE);
98  if (is_null($data)) {
99  return null;
100  }
101  $this->currencyCode = (string) $data;
102  }
103 
104  return $this->currencyCode;
105  }
106 
113  public function getType()
114  {
115  if (is_null($this->type)) {
117  $data = $this->raw(self::FIELD_TYPE);
118  if (is_null($data)) {
119  return null;
120  }
121  $this->type = (string) $data;
122  }
123 
124  return $this->type;
125  }
126 
133  public function getFractionDigits()
134  {
135  if (is_null($this->fractionDigits)) {
137  $data = $this->raw(self::FIELD_FRACTION_DIGITS);
138  if (is_null($data)) {
139  return null;
140  }
141  $this->fractionDigits = (int) $data;
142  }
143 
144  return $this->fractionDigits;
145  }
146 
147 
151  public function setCentAmount(?int $centAmount): void
152  {
153  $this->centAmount = $centAmount;
154  }
155 
159  public function setCurrencyCode(?string $currencyCode): void
160  {
161  $this->currencyCode = $currencyCode;
162  }
163 
167  public function setFractionDigits(?int $fractionDigits): void
168  {
169  $this->fractionDigits = $fractionDigits;
170  }
171 }
__construct(?int $centAmount=null, ?string $currencyCode=null, ?int $fractionDigits=null, ?string $type=null)