commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
GraphQLErrorModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use stdClass;
18 
22 final class GraphQLErrorModel extends JsonObjectModel implements GraphQLError
23 {
28  protected $message;
29 
34  protected $locations;
35 
40  protected $path;
41 
46  protected $extensions;
47 
48 
52  public function __construct(
53  ?string $message = null,
55  ?array $path = null,
57  ) {
58  $this->message = $message;
59  $this->locations = $locations;
60  $this->path = $path;
61  $this->extensions = $extensions;
62  }
63 
68  public function getMessage()
69  {
70  if (is_null($this->message)) {
72  $data = $this->raw(self::FIELD_MESSAGE);
73  if (is_null($data)) {
74  return null;
75  }
76  $this->message = (string) $data;
77  }
78 
79  return $this->message;
80  }
81 
86  public function getLocations()
87  {
88  if (is_null($this->locations)) {
90  $data = $this->raw(self::FIELD_LOCATIONS);
91  if (is_null($data)) {
92  return null;
93  }
94  $this->locations = GraphQLErrorLocationCollection::fromArray($data);
95  }
96 
97  return $this->locations;
98  }
99 
104  public function getPath()
105  {
106  if (is_null($this->path)) {
108  $data = $this->raw(self::FIELD_PATH);
109  if (is_null($data)) {
110  return null;
111  }
112  $this->path = $data;
113  }
114 
115  return $this->path;
116  }
117 
124  public function getExtensions()
125  {
126  if (is_null($this->extensions)) {
128  $data = $this->raw(self::FIELD_EXTENSIONS);
129  if (is_null($data)) {
130  return null;
131  }
133  $this->extensions = $className::of($data);
134  }
135 
136  return $this->extensions;
137  }
138 
139 
143  public function setMessage(?string $message): void
144  {
145  $this->message = $message;
146  }
147 
152  {
153  $this->locations = $locations;
154  }
155 
159  public function setPath(?array $path): void
160  {
161  $this->path = $path;
162  }
163 
168  {
169  $this->extensions = $extensions;
170  }
171 }
__construct(?string $message=null, ?GraphQLErrorLocationCollection $locations=null, ?array $path=null, ?GraphQLErrorObject $extensions=null)
setLocations(?GraphQLErrorLocationCollection $locations)