public function detect($text)
    {
        $requestUrl = $this->buildRequestUrl($this->getDetectUrl(), [
            'q' => $text
        ]);

        $response = $this->getResponse($requestUrl);

        if (isset($response['data']['detections'])) {
            return $response['data']['detections'][0][0]['language'];
        }
        throw new TranslateException('Could not detect provided text language.');
    }