commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
InvalidFieldErrorBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
16 use stdClass;
17 
21 final class InvalidFieldErrorBuilder implements Builder
22 {
27  private $message;
28 
33  private $field;
34 
39  private $invalidValue;
40 
45  private $allowedValues;
46 
51  private $resourceIndex;
52 
57  public function getMessage()
58  {
59  return $this->message;
60  }
61 
68  public function getField()
69  {
70  return $this->field;
71  }
72 
79  public function getInvalidValue()
80  {
81  return $this->invalidValue;
82  }
83 
90  public function getAllowedValues()
91  {
92  return $this->allowedValues;
93  }
94 
99  public function getResourceIndex()
100  {
101  return $this->resourceIndex;
102  }
103 
108  public function withMessage(?string $message)
109  {
110  $this->message = $message;
111 
112  return $this;
113  }
114 
119  public function withField(?string $field)
120  {
121  $this->field = $field;
122 
123  return $this;
124  }
125 
130  public function withInvalidValue($invalidValue)
131  {
132  $this->invalidValue = $invalidValue;
133 
134  return $this;
135  }
136 
141  public function withAllowedValues(?array $allowedValues)
142  {
143  $this->allowedValues = $allowedValues;
144 
145  return $this;
146  }
147 
152  public function withResourceIndex(?int $resourceIndex)
153  {
154  $this->resourceIndex = $resourceIndex;
155 
156  return $this;
157  }
158 
159 
160  public function build(): InvalidFieldError
161  {
162  return new InvalidFieldErrorModel(
163  $this->message,
164  $this->field,
165  $this->invalidValue,
166  $this->allowedValues,
167  $this->resourceIndex
168  );
169  }
170 
171  public static function of(): InvalidFieldErrorBuilder
172  {
173  return new self();
174  }
175 }