commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ExtensionDraftBuilder.php
1<?php
2
3declare(strict_types=1);
10
16use stdClass;
17
21final class ExtensionDraftBuilder implements Builder
22{
27 private $key;
28
33 private $destination;
34
39 private $triggers;
40
45 private $timeoutInMs;
46
51 private $dependencies;
52
57 private $expansionPaths;
58
63 private $additionalContext;
64
71 public function getKey()
72 {
73 return $this->key;
74 }
75
82 public function getDestination()
83 {
84 return $this->destination instanceof ExtensionDestinationBuilder ? $this->destination->build() : $this->destination;
85 }
86
93 public function getTriggers()
94 {
95 return $this->triggers;
96 }
97
108 public function getTimeoutInMs()
109 {
110 return $this->timeoutInMs;
111 }
112
119 public function getDependencies()
120 {
121 return $this->dependencies;
122 }
123
131 public function getExpansionPaths()
132 {
133 return $this->expansionPaths;
134 }
135
142 public function getAdditionalContext()
143 {
144 return $this->additionalContext instanceof ExtensionAdditionalContextDraftBuilder ? $this->additionalContext->build() : $this->additionalContext;
145 }
146
151 public function withKey(?string $key)
152 {
153 $this->key = $key;
154
155 return $this;
156 }
157
162 public function withDestination(?ExtensionDestination $destination)
163 {
164 $this->destination = $destination;
165
166 return $this;
167 }
168
173 public function withTriggers(?ExtensionTriggerCollection $triggers)
174 {
175 $this->triggers = $triggers;
176
177 return $this;
178 }
179
184 public function withTimeoutInMs(?int $timeoutInMs)
185 {
186 $this->timeoutInMs = $timeoutInMs;
187
188 return $this;
189 }
190
196 {
197 $this->dependencies = $dependencies;
198
199 return $this;
200 }
201
206 public function withExpansionPaths(?array $expansionPaths)
207 {
208 $this->expansionPaths = $expansionPaths;
209
210 return $this;
211 }
212
217 public function withAdditionalContext(?ExtensionAdditionalContextDraft $additionalContext)
218 {
219 $this->additionalContext = $additionalContext;
220
221 return $this;
222 }
223
229 {
230 $this->destination = $destination;
231
232 return $this;
233 }
234
240 {
241 $this->additionalContext = $additionalContext;
242
243 return $this;
244 }
245
246 public function build(): ExtensionDraft
247 {
248 return new ExtensionDraftModel(
249 $this->key,
250 $this->destination instanceof ExtensionDestinationBuilder ? $this->destination->build() : $this->destination,
251 $this->triggers,
252 $this->timeoutInMs,
253 $this->dependencies,
254 $this->expansionPaths,
255 $this->additionalContext instanceof ExtensionAdditionalContextDraftBuilder ? $this->additionalContext->build() : $this->additionalContext
256 );
257 }
258
259 public static function of(): ExtensionDraftBuilder
260 {
261 return new self();
262 }
263}
withDestinationBuilder(?ExtensionDestinationBuilder $destination)
withDependencies(?ExtensionResourceIdentifierCollection $dependencies)
withAdditionalContext(?ExtensionAdditionalContextDraft $additionalContext)
withAdditionalContextBuilder(?ExtensionAdditionalContextDraftBuilder $additionalContext)