src/API/Implementation/Translate/Yandex/YandexTranslateApi.php
protected function createTranslateContext(
        string $text,
        Language $languageTo,
        Language $languageFrom
    ): RequestContext {
        $requestContext = (new RequestContext(sprintf("%s/%s", $this->apiEndpoint, self::TRANSLATE_API_PATH)))
            ->setRequestParameters(
                [
                    'lang' => $this->getLanguageString($languageTo, $languageFrom)
                ] + $this->getAuthData()
            )
            ->setData(['text' => $text])
            ->setMethod(RequestContext::METHOD_POST);

        return $this->fillGeneralRequestSettings($requestContext);
    }
protected function createTranslateContext(
        string $text,
        Language $languageTo,
        Language $languageFrom
    ): RequestContext {
        $requestContext = (new RequestContext(sprintf("%s/%s", $this->apiEndpoint, self::TRANSLATE_API_PATH)))
            ->setRequestParameters(
                [
                    'lang' => $this->getLanguageString($languageTo, $languageFrom)
                ] + $this->getAuthData()
            )
            ->setData(['text' => $text])
            ->setMethod(RequestContext::METHOD_POST);

        return $this->fillGeneralRequestSettings($requestContext);
    }
protected function createTranslateContext ( string $ text , Language $ languageTo , Language $ languageFrom ) : RequestContext { $ requestContext = ( new RequestContext ( sprintf ( "%s/%s" , $ this -> apiEndpoint , self :: TRANSLATE_API_PATH ) ) ) -> setRequestParameters ( [ 'lang' => $ this -> getLanguageString ( $ languageTo , $ languageFrom ) ] + $ this -> getAuthData ( ) ) -> setData ( [ 'text' => $ text ] ) -> setMethod ( RequestContext :: METHOD_POST ) ; return $ this -> fillGeneralRequestSettings ( $ requestContext ) ; }
Create request context for translate request

@param string   $text
@param Language $languageTo
@param Language $languageFrom

@throws RequestContextException

@return RequestContext
Create request context for translate request