commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ExtensionDraftModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
15 use stdClass;
16 
20 final class ExtensionDraftModel extends JsonObjectModel implements ExtensionDraft
21 {
26  protected $key;
27 
32  protected $destination;
33 
38  protected $triggers;
39 
44  protected $timeoutInMs;
45 
46 
50  public function __construct(
51  ?string $key = null,
54  ?int $timeoutInMs = null
55  ) {
56  $this->key = $key;
57  $this->destination = $destination;
58  $this->triggers = $triggers;
59  $this->timeoutInMs = $timeoutInMs;
60  }
61 
68  public function getKey()
69  {
70  if (is_null($this->key)) {
72  $data = $this->raw(self::FIELD_KEY);
73  if (is_null($data)) {
74  return null;
75  }
76  $this->key = (string) $data;
77  }
78 
79  return $this->key;
80  }
81 
88  public function getDestination()
89  {
90  if (is_null($this->destination)) {
92  $data = $this->raw(self::FIELD_DESTINATION);
93  if (is_null($data)) {
94  return null;
95  }
97  $this->destination = $className::of($data);
98  }
99 
100  return $this->destination;
101  }
102 
109  public function getTriggers()
110  {
111  if (is_null($this->triggers)) {
113  $data = $this->raw(self::FIELD_TRIGGERS);
114  if (is_null($data)) {
115  return null;
116  }
117  $this->triggers = ExtensionTriggerCollection::fromArray($data);
118  }
119 
120  return $this->triggers;
121  }
122 
133  public function getTimeoutInMs()
134  {
135  if (is_null($this->timeoutInMs)) {
137  $data = $this->raw(self::FIELD_TIMEOUT_IN_MS);
138  if (is_null($data)) {
139  return null;
140  }
141  $this->timeoutInMs = (int) $data;
142  }
143 
144  return $this->timeoutInMs;
145  }
146 
147 
151  public function setKey(?string $key): void
152  {
153  $this->key = $key;
154  }
155 
160  {
161  $this->destination = $destination;
162  }
163 
168  {
169  $this->triggers = $triggers;
170  }
171 
175  public function setTimeoutInMs(?int $timeoutInMs): void
176  {
177  $this->timeoutInMs = $timeoutInMs;
178  }
179 }
__construct(?string $key=null, ?ExtensionDestination $destination=null, ?ExtensionTriggerCollection $triggers=null, ?int $timeoutInMs=null)
setTriggers(?ExtensionTriggerCollection $triggers)