commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
AttributeGroupDraftBuilder.php
1<?php
2
3declare(strict_types=1);
10
18use stdClass;
19
23final class AttributeGroupDraftBuilder implements Builder
24{
29 private $name;
30
35 private $description;
36
41 private $attributes;
42
47 private $key;
48
55 public function getName()
56 {
57 return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
58 }
59
66 public function getDescription()
67 {
68 return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
69 }
70
77 public function getAttributes()
78 {
79 return $this->attributes;
80 }
81
88 public function getKey()
89 {
90 return $this->key;
91 }
92
97 public function withName(?LocalizedString $name)
98 {
99 $this->name = $name;
100
101 return $this;
102 }
103
108 public function withDescription(?LocalizedString $description)
109 {
110 $this->description = $description;
111
112 return $this;
113 }
114
119 public function withAttributes(?AttributeReferenceCollection $attributes)
120 {
121 $this->attributes = $attributes;
122
123 return $this;
124 }
125
130 public function withKey(?string $key)
131 {
132 $this->key = $key;
133
134 return $this;
135 }
136
142 {
143 $this->name = $name;
144
145 return $this;
146 }
147
152 public function withDescriptionBuilder(?LocalizedStringBuilder $description)
153 {
154 $this->description = $description;
155
156 return $this;
157 }
158
159 public function build(): AttributeGroupDraft
160 {
161 return new AttributeGroupDraftModel(
162 $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
163 $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
164 $this->attributes,
165 $this->key
166 );
167 }
168
169 public static function of(): AttributeGroupDraftBuilder
170 {
171 return new self();
172 }
173}