commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
MoneySetFieldModel.php
1<?php
2
3declare(strict_types=1);
10
16use stdClass;
17
21final class MoneySetFieldModel extends JsonObjectModel implements MoneySetField
22{
23 public const DISCRIMINATOR_VALUE = 'MoneySet';
28 protected $type;
29
34 protected $value;
35
36
40 public function __construct(
41 ?MoneyCollection $value = null,
42 ?string $type = null
43 ) {
44 $this->value = $value;
45 $this->type = $type ?? self::DISCRIMINATOR_VALUE;
46 }
47
54 public function getType()
55 {
56 if (is_null($this->type)) {
58 $data = $this->raw(self::FIELD_TYPE);
59 if (is_null($data)) {
60 return null;
61 }
62 $this->type = (string) $data;
63 }
64
65 return $this->type;
66 }
67
72 public function getValue()
73 {
74 if (is_null($this->value)) {
76 $data = $this->raw(self::FIELD_VALUE);
77 if (is_null($data)) {
78 return null;
79 }
80 $this->value = MoneyCollection::fromArray($data);
81 }
82
83 return $this->value;
84 }
85
86
90 public function setValue(?MoneyCollection $value): void
91 {
92 $this->value = $value;
93 }
94}
__construct(?MoneyCollection $value=null, ?string $type=null)