commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ProductSelectionDraftBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
20 use stdClass;
21 
25 final class ProductSelectionDraftBuilder implements Builder
26 {
31  private $key;
32 
37  private $name;
38 
43  private $custom;
44 
49  private $mode;
50 
57  public function getKey()
58  {
59  return $this->key;
60  }
61 
68  public function getName()
69  {
70  return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
71  }
72 
79  public function getCustom()
80  {
81  return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
82  }
83 
90  public function getMode()
91  {
92  return $this->mode;
93  }
94 
99  public function withKey(?string $key)
100  {
101  $this->key = $key;
102 
103  return $this;
104  }
105 
110  public function withName(?LocalizedString $name)
111  {
112  $this->name = $name;
113 
114  return $this;
115  }
116 
121  public function withCustom(?CustomFieldsDraft $custom)
122  {
123  $this->custom = $custom;
124 
125  return $this;
126  }
127 
132  public function withMode(?string $mode)
133  {
134  $this->mode = $mode;
135 
136  return $this;
137  }
138 
143  public function withNameBuilder(?LocalizedStringBuilder $name)
144  {
145  $this->name = $name;
146 
147  return $this;
148  }
149 
154  public function withCustomBuilder(?CustomFieldsDraftBuilder $custom)
155  {
156  $this->custom = $custom;
157 
158  return $this;
159  }
160 
161  public function build(): ProductSelectionDraft
162  {
163  return new ProductSelectionDraftModel(
164  $this->key,
165  $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
166  $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom,
167  $this->mode
168  );
169  }
170 
171  public static function of(): ProductSelectionDraftBuilder
172  {
173  return new self();
174  }
175 }