commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
AssociateRoleDraftBuilder.php
1<?php
2
3declare(strict_types=1);
10
18use stdClass;
19
23final class AssociateRoleDraftBuilder implements Builder
24{
29 private $key;
30
35 private $name;
36
41 private $buyerAssignable;
42
47 private $permissions;
48
53 private $custom;
54
61 public function getKey()
62 {
63 return $this->key;
64 }
65
72 public function getName()
73 {
74 return $this->name;
75 }
76
83 public function getBuyerAssignable()
84 {
85 return $this->buyerAssignable;
86 }
87
94 public function getPermissions()
95 {
96 return $this->permissions;
97 }
98
105 public function getCustom()
106 {
107 return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
108 }
109
114 public function withKey(?string $key)
115 {
116 $this->key = $key;
117
118 return $this;
119 }
120
125 public function withName(?string $name)
126 {
127 $this->name = $name;
128
129 return $this;
130 }
131
136 public function withBuyerAssignable(?bool $buyerAssignable)
137 {
138 $this->buyerAssignable = $buyerAssignable;
139
140 return $this;
141 }
142
147 public function withPermissions(?array $permissions)
148 {
149 $this->permissions = $permissions;
150
151 return $this;
152 }
153
158 public function withCustom(?CustomFieldsDraft $custom)
159 {
160 $this->custom = $custom;
161
162 return $this;
163 }
164
170 {
171 $this->custom = $custom;
172
173 return $this;
174 }
175
176 public function build(): AssociateRoleDraft
177 {
178 return new AssociateRoleDraftModel(
179 $this->key,
180 $this->name,
181 $this->buyerAssignable,
182 $this->permissions,
183 $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom
184 );
185 }
186
187 public static function of(): AssociateRoleDraftBuilder
188 {
189 return new self();
190 }
191}