| Total Complexity | 5 |
| Total Lines | 60 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class ExecutionResult implements SerializationInterface |
||
| 10 | { |
||
| 11 | |||
| 12 | /** |
||
| 13 | * @var GraphQLError[] |
||
| 14 | */ |
||
| 15 | protected $errors; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @var mixed[] |
||
| 19 | */ |
||
| 20 | protected $data; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * ExecutionResult constructor. |
||
| 24 | * |
||
| 25 | * @param mixed[] $data |
||
| 26 | * @param GraphQLError[] $errors |
||
| 27 | */ |
||
| 28 | public function __construct(?array $data, ?array $errors) |
||
| 29 | { |
||
| 30 | $this->errors = $errors; |
||
| 31 | $this->data = $data; |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @return array|GraphQLError[] |
||
| 36 | */ |
||
| 37 | public function getErrors(): array |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @param GraphQLError $error |
||
| 44 | * @return ExecutionResult |
||
| 45 | */ |
||
| 46 | public function addError(GraphQLError $error): ExecutionResult |
||
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * @inheritdoc |
||
| 54 | */ |
||
| 55 | public function toArray(): array |
||
| 56 | { |
||
| 57 | return [ |
||
| 58 | 'data' => $this->data, |
||
| 59 | 'errors' => $this->errors, |
||
| 60 | ]; |
||
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @inheritdoc |
||
| 65 | */ |
||
| 66 | public function toJSON(): string |
||
| 69 | } |
||
| 70 | } |
||
| 71 |