commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
AttributeNestedTypeBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
18 use stdClass;
19 
23 final class AttributeNestedTypeBuilder implements Builder
24 {
29  private $typeReference;
30 
37  public function getTypeReference()
38  {
39  return $this->typeReference instanceof ProductTypeKeyReferenceBuilder ? $this->typeReference->build() : $this->typeReference;
40  }
41 
46  public function withTypeReference(?ProductTypeKeyReference $typeReference)
47  {
48  $this->typeReference = $typeReference;
49 
50  return $this;
51  }
52 
58  {
59  $this->typeReference = $typeReference;
60 
61  return $this;
62  }
63 
64  public function build(): AttributeNestedType
65  {
66  return new AttributeNestedTypeModel(
67  $this->typeReference instanceof ProductTypeKeyReferenceBuilder ? $this->typeReference->build() : $this->typeReference
68  );
69  }
70 
71  public static function of(): AttributeNestedTypeBuilder
72  {
73  return new self();
74  }
75 }
withTypeReferenceBuilder(?ProductTypeKeyReferenceBuilder $typeReference)