commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
All Classes Namespaces Functions Variables Pages
SubscriptionDraftModel.php
1<?php
2
3declare(strict_types=1);
10
15use stdClass;
16
21{
26 protected $changes;
27
32 protected $destination;
33
38 protected $key;
39
44 protected $messages;
45
50 protected $events;
51
56 protected $format;
57
58
62 public function __construct(
65 ?string $key = null,
69 ) {
70 $this->changes = $changes;
71 $this->destination = $destination;
72 $this->key = $key;
73 $this->messages = $messages;
74 $this->events = $events;
75 $this->format = $format;
76 }
77
84 public function getChanges()
85 {
86 if (is_null($this->changes)) {
88 $data = $this->raw(self::FIELD_CHANGES);
89 if (is_null($data)) {
90 return null;
91 }
92 $this->changes = ChangeSubscriptionCollection::fromArray($data);
93 }
94
95 return $this->changes;
96 }
97
104 public function getDestination()
105 {
106 if (is_null($this->destination)) {
108 $data = $this->raw(self::FIELD_DESTINATION);
109 if (is_null($data)) {
110 return null;
111 }
113 $this->destination = $className::of($data);
114 }
115
116 return $this->destination;
117 }
118
125 public function getKey()
126 {
127 if (is_null($this->key)) {
129 $data = $this->raw(self::FIELD_KEY);
130 if (is_null($data)) {
131 return null;
132 }
133 $this->key = (string) $data;
134 }
135
136 return $this->key;
137 }
138
145 public function getMessages()
146 {
147 if (is_null($this->messages)) {
149 $data = $this->raw(self::FIELD_MESSAGES);
150 if (is_null($data)) {
151 return null;
152 }
153 $this->messages = MessageSubscriptionCollection::fromArray($data);
154 }
155
156 return $this->messages;
157 }
158
165 public function getEvents()
166 {
167 if (is_null($this->events)) {
169 $data = $this->raw(self::FIELD_EVENTS);
170 if (is_null($data)) {
171 return null;
172 }
173 $this->events = EventSubscriptionCollection::fromArray($data);
174 }
175
176 return $this->events;
177 }
178
185 public function getFormat()
186 {
187 if (is_null($this->format)) {
189 $data = $this->raw(self::FIELD_FORMAT);
190 if (is_null($data)) {
191 return null;
192 }
194 $this->format = $className::of($data);
195 }
196
197 return $this->format;
198 }
199
200
205 {
206 $this->changes = $changes;
207 }
208
213 {
214 $this->destination = $destination;
215 }
216
220 public function setKey(?string $key): void
221 {
222 $this->key = $key;
223 }
224
229 {
230 $this->messages = $messages;
231 }
232
237 {
238 $this->events = $events;
239 }
240
244 public function setFormat(?DeliveryFormat $format): void
245 {
246 $this->format = $format;
247 }
248}
__construct(?ChangeSubscriptionCollection $changes=null, ?Destination $destination=null, ?string $key=null, ?MessageSubscriptionCollection $messages=null, ?EventSubscriptionCollection $events=null, ?DeliveryFormat $format=null)
static fromArray(array $data)