commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
TypedMoneyBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
16 use stdClass;
17 
21 final class TypedMoneyBuilder implements Builder
22 {
27  private $fractionDigits;
28 
33  private $centAmount;
34 
39  private $currencyCode;
40 
45  public function getFractionDigits()
46  {
47  return $this->fractionDigits;
48  }
49 
54  public function getCentAmount()
55  {
56  return $this->centAmount;
57  }
58 
65  public function getCurrencyCode()
66  {
67  return $this->currencyCode;
68  }
69 
74  public function withFractionDigits(?int $fractionDigits)
75  {
76  $this->fractionDigits = $fractionDigits;
77 
78  return $this;
79  }
80 
85  public function withCentAmount(?int $centAmount)
86  {
87  $this->centAmount = $centAmount;
88 
89  return $this;
90  }
91 
96  public function withCurrencyCode(?string $currencyCode)
97  {
98  $this->currencyCode = $currencyCode;
99 
100  return $this;
101  }
102 
103 
104  public function build(): TypedMoney
105  {
106  return new TypedMoneyModel(
107  $this->fractionDigits,
108  $this->centAmount,
109  $this->currencyCode
110  );
111  }
112 
113  public static function of(): TypedMoneyBuilder
114  {
115  return new self();
116  }
117 }