commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
AssignedProductSelectionBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
16 use DateTimeImmutable;
17 use stdClass;
18 
23 {
28  private $productSelection;
29 
34  private $variantSelection;
35 
40  private $variantExclusion;
41 
46  private $createdAt;
47 
54  public function getProductSelection()
55  {
56  return $this->productSelection instanceof ProductSelectionReferenceBuilder ? $this->productSelection->build() : $this->productSelection;
57  }
58 
66  public function getVariantSelection()
67  {
68  return $this->variantSelection instanceof ProductVariantSelectionBuilder ? $this->variantSelection->build() : $this->variantSelection;
69  }
70 
78  public function getVariantExclusion()
79  {
80  return $this->variantExclusion instanceof ProductVariantExclusionBuilder ? $this->variantExclusion->build() : $this->variantExclusion;
81  }
82 
89  public function getCreatedAt()
90  {
91  return $this->createdAt;
92  }
93 
98  public function withProductSelection(?ProductSelectionReference $productSelection)
99  {
100  $this->productSelection = $productSelection;
101 
102  return $this;
103  }
104 
109  public function withVariantSelection(?ProductVariantSelection $variantSelection)
110  {
111  $this->variantSelection = $variantSelection;
112 
113  return $this;
114  }
115 
120  public function withVariantExclusion(?ProductVariantExclusion $variantExclusion)
121  {
122  $this->variantExclusion = $variantExclusion;
123 
124  return $this;
125  }
126 
131  public function withCreatedAt(?DateTimeImmutable $createdAt)
132  {
133  $this->createdAt = $createdAt;
134 
135  return $this;
136  }
137 
143  {
144  $this->productSelection = $productSelection;
145 
146  return $this;
147  }
148 
154  {
155  $this->variantSelection = $variantSelection;
156 
157  return $this;
158  }
159 
165  {
166  $this->variantExclusion = $variantExclusion;
167 
168  return $this;
169  }
170 
171  public function build(): AssignedProductSelection
172  {
174  $this->productSelection instanceof ProductSelectionReferenceBuilder ? $this->productSelection->build() : $this->productSelection,
175  $this->variantSelection instanceof ProductVariantSelectionBuilder ? $this->variantSelection->build() : $this->variantSelection,
176  $this->variantExclusion instanceof ProductVariantExclusionBuilder ? $this->variantExclusion->build() : $this->variantExclusion,
177  $this->createdAt
178  );
179  }
180 
181  public static function of(): AssignedProductSelectionBuilder
182  {
183  return new self();
184  }
185 }