data = $data; $this->errors = $errors; } public function toArray() { $result = ['data' => $this->data]; if (!empty($this->errors)) { $result['errors'] = array_map(['GraphQL\Error', 'formatError'], $this->errors); } return $result; } }