commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
All Classes Namespaces Functions Variables Pages
SubscriptionDraftBuilder.php
1<?php
2
3declare(strict_types=1);
10
16use stdClass;
17
21final class SubscriptionDraftBuilder implements Builder
22{
27 private $changes;
28
33 private $destination;
34
39 private $key;
40
45 private $messages;
46
51 private $events;
52
57 private $format;
58
65 public function getChanges()
66 {
67 return $this->changes;
68 }
69
76 public function getDestination()
77 {
78 return $this->destination instanceof DestinationBuilder ? $this->destination->build() : $this->destination;
79 }
80
87 public function getKey()
88 {
89 return $this->key;
90 }
91
98 public function getMessages()
99 {
100 return $this->messages;
101 }
102
109 public function getEvents()
110 {
111 return $this->events;
112 }
113
120 public function getFormat()
121 {
122 return $this->format instanceof DeliveryFormatBuilder ? $this->format->build() : $this->format;
123 }
124
129 public function withChanges(?ChangeSubscriptionCollection $changes)
130 {
131 $this->changes = $changes;
132
133 return $this;
134 }
135
140 public function withDestination(?Destination $destination)
141 {
142 $this->destination = $destination;
143
144 return $this;
145 }
146
151 public function withKey(?string $key)
152 {
153 $this->key = $key;
154
155 return $this;
156 }
157
162 public function withMessages(?MessageSubscriptionCollection $messages)
163 {
164 $this->messages = $messages;
165
166 return $this;
167 }
168
173 public function withEvents(?EventSubscriptionCollection $events)
174 {
175 $this->events = $events;
176
177 return $this;
178 }
179
184 public function withFormat(?DeliveryFormat $format)
185 {
186 $this->format = $format;
187
188 return $this;
189 }
190
195 public function withDestinationBuilder(?DestinationBuilder $destination)
196 {
197 $this->destination = $destination;
198
199 return $this;
200 }
201
206 public function withFormatBuilder(?DeliveryFormatBuilder $format)
207 {
208 $this->format = $format;
209
210 return $this;
211 }
212
213 public function build(): SubscriptionDraft
214 {
215 return new SubscriptionDraftModel(
216 $this->changes,
217 $this->destination instanceof DestinationBuilder ? $this->destination->build() : $this->destination,
218 $this->key,
219 $this->messages,
220 $this->events,
221 $this->format instanceof DeliveryFormatBuilder ? $this->format->build() : $this->format
222 );
223 }
224
225 public static function of(): SubscriptionDraftBuilder
226 {
227 return new self();
228 }
229}