commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ExtensionDraftBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
16 use stdClass;
17 
21 final class ExtensionDraftBuilder implements Builder
22 {
27  private $key;
28 
33  private $destination;
34 
39  private $triggers;
40 
45  private $timeoutInMs;
46 
53  public function getKey()
54  {
55  return $this->key;
56  }
57 
64  public function getDestination()
65  {
66  return $this->destination instanceof ExtensionDestinationBuilder ? $this->destination->build() : $this->destination;
67  }
68 
75  public function getTriggers()
76  {
77  return $this->triggers;
78  }
79 
90  public function getTimeoutInMs()
91  {
92  return $this->timeoutInMs;
93  }
94 
99  public function withKey(?string $key)
100  {
101  $this->key = $key;
102 
103  return $this;
104  }
105 
110  public function withDestination(?ExtensionDestination $destination)
111  {
112  $this->destination = $destination;
113 
114  return $this;
115  }
116 
121  public function withTriggers(?ExtensionTriggerCollection $triggers)
122  {
123  $this->triggers = $triggers;
124 
125  return $this;
126  }
127 
132  public function withTimeoutInMs(?int $timeoutInMs)
133  {
134  $this->timeoutInMs = $timeoutInMs;
135 
136  return $this;
137  }
138 
144  {
145  $this->destination = $destination;
146 
147  return $this;
148  }
149 
150  public function build(): ExtensionDraft
151  {
152  return new ExtensionDraftModel(
153  $this->key,
154  $this->destination instanceof ExtensionDestinationBuilder ? $this->destination->build() : $this->destination,
155  $this->triggers,
156  $this->timeoutInMs
157  );
158  }
159 
160  public static function of(): ExtensionDraftBuilder
161  {
162  return new self();
163  }
164 }
withDestinationBuilder(?ExtensionDestinationBuilder $destination)