commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
CustomFieldSetTypeBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
16 use stdClass;
17 
21 final class CustomFieldSetTypeBuilder implements Builder
22 {
27  private $elementType;
28 
35  public function getElementType()
36  {
37  return $this->elementType instanceof FieldTypeBuilder ? $this->elementType->build() : $this->elementType;
38  }
39 
44  public function withElementType(?FieldType $elementType)
45  {
46  $this->elementType = $elementType;
47 
48  return $this;
49  }
50 
55  public function withElementTypeBuilder(?FieldTypeBuilder $elementType)
56  {
57  $this->elementType = $elementType;
58 
59  return $this;
60  }
61 
62  public function build(): CustomFieldSetType
63  {
64  return new CustomFieldSetTypeModel(
65  $this->elementType instanceof FieldTypeBuilder ? $this->elementType->build() : $this->elementType
66  );
67  }
68 
69  public static function of(): CustomFieldSetTypeBuilder
70  {
71  return new self();
72  }
73 }