commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
GraphQLErrorBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
18 use stdClass;
19 
23 final class GraphQLErrorBuilder implements Builder
24 {
29  private $message;
30 
35  private $locations;
36 
41  private $path;
42 
47  private $extensions;
48 
53  public function getMessage()
54  {
55  return $this->message;
56  }
57 
62  public function getLocations()
63  {
64  return $this->locations;
65  }
66 
71  public function getPath()
72  {
73  return $this->path;
74  }
75 
82  public function getExtensions()
83  {
84  return $this->extensions instanceof GraphQLErrorObjectBuilder ? $this->extensions->build() : $this->extensions;
85  }
86 
91  public function withMessage(?string $message)
92  {
93  $this->message = $message;
94 
95  return $this;
96  }
97 
102  public function withLocations(?GraphQLErrorLocationCollection $locations)
103  {
104  $this->locations = $locations;
105 
106  return $this;
107  }
108 
113  public function withPath(?array $path)
114  {
115  $this->path = $path;
116 
117  return $this;
118  }
119 
124  public function withExtensions(?GraphQLErrorObject $extensions)
125  {
126  $this->extensions = $extensions;
127 
128  return $this;
129  }
130 
135  public function withExtensionsBuilder(?GraphQLErrorObjectBuilder $extensions)
136  {
137  $this->extensions = $extensions;
138 
139  return $this;
140  }
141 
142  public function build(): GraphQLError
143  {
144  return new GraphQLErrorModel(
145  $this->message,
146  $this->locations,
147  $this->path,
148  $this->extensions instanceof GraphQLErrorObjectBuilder ? $this->extensions->build() : $this->extensions
149  );
150  }
151 
152  public static function of(): GraphQLErrorBuilder
153  {
154  return new self();
155  }
156 }
withExtensionsBuilder(?GraphQLErrorObjectBuilder $extensions)
withLocations(?GraphQLErrorLocationCollection $locations)