commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
DuplicatePriceScopeErrorModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use stdClass;
18 
23 {
24  public const DISCRIMINATOR_VALUE = 'DuplicatePriceScope';
29  protected $code;
30 
35  protected $message;
36 
41  protected $conflictingPrice;
42 
43 
47  public function __construct(
48  ?string $message = null,
49  ?Price $conflictingPrice = null,
50  ?string $code = null
51  ) {
52  $this->message = $message;
53  $this->conflictingPrice = $conflictingPrice;
54  $this->code = $code ?? self::DISCRIMINATOR_VALUE;
55  }
56 
61  public function getCode()
62  {
63  if (is_null($this->code)) {
65  $data = $this->raw(self::FIELD_CODE);
66  if (is_null($data)) {
67  return null;
68  }
69  $this->code = (string) $data;
70  }
71 
72  return $this->code;
73  }
74 
81  public function getMessage()
82  {
83  if (is_null($this->message)) {
85  $data = $this->raw(self::FIELD_MESSAGE);
86  if (is_null($data)) {
87  return null;
88  }
89  $this->message = (string) $data;
90  }
91 
92  return $this->message;
93  }
94 
101  public function getConflictingPrice()
102  {
103  if (is_null($this->conflictingPrice)) {
105  $data = $this->raw(self::FIELD_CONFLICTING_PRICE);
106  if (is_null($data)) {
107  return null;
108  }
109 
110  $this->conflictingPrice = PriceModel::of($data);
111  }
112 
114  }
115 
116 
120  public function setMessage(?string $message): void
121  {
122  $this->message = $message;
123  }
124 
129  {
130  $this->conflictingPrice = $conflictingPrice;
131  }
132 
136  public function by(string $key)
137  {
138  $data = $this->raw($key);
139  if (is_null($data)) {
140  return null;
141  }
142 
143  return $data;
144  }
145 }
__construct(?string $message=null, ?Price $conflictingPrice=null, ?string $code=null)