commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
DuplicateFieldErrorBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
16 use stdClass;
17 
21 final class DuplicateFieldErrorBuilder implements Builder
22 {
27  private $message;
28 
33  private $field;
34 
39  private $duplicateValue;
40 
45  public function getMessage()
46  {
47  return $this->message;
48  }
49 
56  public function getField()
57  {
58  return $this->field;
59  }
60 
67  public function getDuplicateValue()
68  {
69  return $this->duplicateValue;
70  }
71 
76  public function withMessage(?string $message)
77  {
78  $this->message = $message;
79 
80  return $this;
81  }
82 
87  public function withField(?string $field)
88  {
89  $this->field = $field;
90 
91  return $this;
92  }
93 
98  public function withDuplicateValue($duplicateValue)
99  {
100  $this->duplicateValue = $duplicateValue;
101 
102  return $this;
103  }
104 
105 
106  public function build(): DuplicateFieldError
107  {
108  return new DuplicateFieldErrorModel(
109  $this->message,
110  $this->field,
111  $this->duplicateValue
112  );
113  }
114 
115  public static function of(): DuplicateFieldErrorBuilder
116  {
117  return new self();
118  }
119 }