commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
GraphQLResponseBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
16 use stdClass;
17 
21 final class GraphQLResponseBuilder implements Builder
22 {
27  private $data;
28 
33  private $errors;
34 
39  public function getData()
40  {
41  return $this->data;
42  }
43 
48  public function getErrors()
49  {
50  return $this->errors;
51  }
52 
57  public function withData($data)
58  {
59  $this->data = $data;
60 
61  return $this;
62  }
63 
68  public function withErrors(?GraphQLErrorCollection $errors)
69  {
70  $this->errors = $errors;
71 
72  return $this;
73  }
74 
75 
76  public function build(): GraphQLResponse
77  {
78  return new GraphQLResponseModel(
79  $this->data,
80  $this->errors
81  );
82  }
83 
84  public static function of(): GraphQLResponseBuilder
85  {
86  return new self();
87  }
88 }