commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
SubscriptionDraftModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
15 use stdClass;
16 
21 {
26  protected $changes;
27 
32  protected $destination;
33 
38  protected $key;
39 
44  protected $messages;
45 
50  protected $format;
51 
52 
56  public function __construct(
58  ?Destination $destination = null,
59  ?string $key = null,
61  ?DeliveryFormat $format = null
62  ) {
63  $this->changes = $changes;
64  $this->destination = $destination;
65  $this->key = $key;
66  $this->messages = $messages;
67  $this->format = $format;
68  }
69 
76  public function getChanges()
77  {
78  if (is_null($this->changes)) {
80  $data = $this->raw(self::FIELD_CHANGES);
81  if (is_null($data)) {
82  return null;
83  }
84  $this->changes = ChangeSubscriptionCollection::fromArray($data);
85  }
86 
87  return $this->changes;
88  }
89 
96  public function getDestination()
97  {
98  if (is_null($this->destination)) {
100  $data = $this->raw(self::FIELD_DESTINATION);
101  if (is_null($data)) {
102  return null;
103  }
105  $this->destination = $className::of($data);
106  }
107 
108  return $this->destination;
109  }
110 
117  public function getKey()
118  {
119  if (is_null($this->key)) {
121  $data = $this->raw(self::FIELD_KEY);
122  if (is_null($data)) {
123  return null;
124  }
125  $this->key = (string) $data;
126  }
127 
128  return $this->key;
129  }
130 
137  public function getMessages()
138  {
139  if (is_null($this->messages)) {
141  $data = $this->raw(self::FIELD_MESSAGES);
142  if (is_null($data)) {
143  return null;
144  }
145  $this->messages = MessageSubscriptionCollection::fromArray($data);
146  }
147 
148  return $this->messages;
149  }
150 
157  public function getFormat()
158  {
159  if (is_null($this->format)) {
161  $data = $this->raw(self::FIELD_FORMAT);
162  if (is_null($data)) {
163  return null;
164  }
166  $this->format = $className::of($data);
167  }
168 
169  return $this->format;
170  }
171 
172 
177  {
178  $this->changes = $changes;
179  }
180 
184  public function setDestination(?Destination $destination): void
185  {
186  $this->destination = $destination;
187  }
188 
192  public function setKey(?string $key): void
193  {
194  $this->key = $key;
195  }
196 
201  {
202  $this->messages = $messages;
203  }
204 
208  public function setFormat(?DeliveryFormat $format): void
209  {
210  $this->format = $format;
211  }
212 }
__construct(?ChangeSubscriptionCollection $changes=null, ?Destination $destination=null, ?string $key=null, ?MessageSubscriptionCollection $messages=null, ?DeliveryFormat $format=null)