commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ProductSelectionAssignmentBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
18 use stdClass;
19 
24 {
29  private $product;
30 
35  private $productSelection;
36 
41  private $variantSelection;
42 
47  private $variantExclusion;
48 
55  public function getProduct()
56  {
57  return $this->product instanceof ProductReferenceBuilder ? $this->product->build() : $this->product;
58  }
59 
66  public function getProductSelection()
67  {
68  return $this->productSelection instanceof ProductSelectionReferenceBuilder ? $this->productSelection->build() : $this->productSelection;
69  }
70 
79  public function getVariantSelection()
80  {
81  return $this->variantSelection instanceof ProductVariantSelectionBuilder ? $this->variantSelection->build() : $this->variantSelection;
82  }
83 
92  public function getVariantExclusion()
93  {
94  return $this->variantExclusion instanceof ProductVariantExclusionBuilder ? $this->variantExclusion->build() : $this->variantExclusion;
95  }
96 
101  public function withProduct(?ProductReference $product)
102  {
103  $this->product = $product;
104 
105  return $this;
106  }
107 
112  public function withProductSelection(?ProductSelectionReference $productSelection)
113  {
114  $this->productSelection = $productSelection;
115 
116  return $this;
117  }
118 
123  public function withVariantSelection(?ProductVariantSelection $variantSelection)
124  {
125  $this->variantSelection = $variantSelection;
126 
127  return $this;
128  }
129 
134  public function withVariantExclusion(?ProductVariantExclusion $variantExclusion)
135  {
136  $this->variantExclusion = $variantExclusion;
137 
138  return $this;
139  }
140 
145  public function withProductBuilder(?ProductReferenceBuilder $product)
146  {
147  $this->product = $product;
148 
149  return $this;
150  }
151 
157  {
158  $this->productSelection = $productSelection;
159 
160  return $this;
161  }
162 
168  {
169  $this->variantSelection = $variantSelection;
170 
171  return $this;
172  }
173 
179  {
180  $this->variantExclusion = $variantExclusion;
181 
182  return $this;
183  }
184 
186  {
188  $this->product instanceof ProductReferenceBuilder ? $this->product->build() : $this->product,
189  $this->productSelection instanceof ProductSelectionReferenceBuilder ? $this->productSelection->build() : $this->productSelection,
190  $this->variantSelection instanceof ProductVariantSelectionBuilder ? $this->variantSelection->build() : $this->variantSelection,
191  $this->variantExclusion instanceof ProductVariantExclusionBuilder ? $this->variantExclusion->build() : $this->variantExclusion
192  );
193  }
194 
195  public static function of(): ProductSelectionAssignmentBuilder
196  {
197  return new self();
198  }
199 }