commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
MoneyFieldBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
18 use stdClass;
19 
23 final class MoneyFieldBuilder implements Builder
24 {
29  private $value;
30 
35  public function getValue()
36  {
37  return $this->value instanceof TypedMoneyBuilder ? $this->value->build() : $this->value;
38  }
39 
44  public function withValue(?TypedMoney $value)
45  {
46  $this->value = $value;
47 
48  return $this;
49  }
50 
55  public function withValueBuilder(?TypedMoneyBuilder $value)
56  {
57  $this->value = $value;
58 
59  return $this;
60  }
61 
62  public function build(): MoneyField
63  {
64  return new MoneyFieldModel(
65  $this->value instanceof TypedMoneyBuilder ? $this->value->build() : $this->value
66  );
67  }
68 
69  public static function of(): MoneyFieldBuilder
70  {
71  return new self();
72  }
73 }