commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ExtensionErrorModel.php
1<?php
2
3declare(strict_types=1);
10
15use stdClass;
16
21{
26 protected $code;
27
32 protected $message;
33
38 protected $extensionId;
39
44 protected $extensionKey;
45
46
50 public function __construct(
51 ?string $code = null,
52 ?string $message = null,
53 ?string $extensionId = null,
54 ?string $extensionKey = null
55 ) {
56 $this->code = $code;
57 $this->message = $message;
58 $this->extensionId = $extensionId;
59 $this->extensionKey = $extensionKey;
60 }
61
68 public function getCode()
69 {
70 if (is_null($this->code)) {
72 $data = $this->raw(self::FIELD_CODE);
73 if (is_null($data)) {
74 return null;
75 }
76 $this->code = (string) $data;
77 }
78
79 return $this->code;
80 }
81
88 public function getMessage()
89 {
90 if (is_null($this->message)) {
92 $data = $this->raw(self::FIELD_MESSAGE);
93 if (is_null($data)) {
94 return null;
95 }
96 $this->message = (string) $data;
97 }
98
99 return $this->message;
100 }
101
108 public function getExtensionId()
109 {
110 if (is_null($this->extensionId)) {
112 $data = $this->raw(self::FIELD_EXTENSION_ID);
113 if (is_null($data)) {
114 return null;
115 }
116 $this->extensionId = (string) $data;
117 }
118
119 return $this->extensionId;
120 }
121
128 public function getExtensionKey()
129 {
130 if (is_null($this->extensionKey)) {
132 $data = $this->raw(self::FIELD_EXTENSION_KEY);
133 if (is_null($data)) {
134 return null;
135 }
136 $this->extensionKey = (string) $data;
137 }
138
139 return $this->extensionKey;
140 }
141
142
146 public function setCode(?string $code): void
147 {
148 $this->code = $code;
149 }
150
154 public function setMessage(?string $message): void
155 {
156 $this->message = $message;
157 }
158
162 public function setExtensionId(?string $extensionId): void
163 {
164 $this->extensionId = $extensionId;
165 }
166
170 public function setExtensionKey(?string $extensionKey): void
171 {
172 $this->extensionKey = $extensionKey;
173 }
174
178 public function by(string $key)
179 {
180 $data = $this->raw($key);
181 if (is_null($data)) {
182 return null;
183 }
184 if (preg_match(ExtensionError::FIELD_PATTERN4, $key) === 1) {
186 return JsonObjectModel::of($data);
187 }
188
189 return $data;
190 }
191}
__construct(?string $code=null, ?string $message=null, ?string $extensionId=null, ?string $extensionKey=null)