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