PHP Class Stevebauman\Translation\Clients\GoogleTranslateApi

Inheritance: implements Stevebauman\Translation\Contracts\Client
Afficher le fichier Open project: stevebauman/translation

Protected Properties

Свойство Type Description
$client GuzzleHttp\ClientInterface
$config Holds the current config instance.
$endpoint API endpoint
$source source language
$target target language

Méthodes publiques

Méthode Description
__construct ( Illuminate\Contracts\Foundation\Application $app, GuzzleHttp\ClientInterface $client )
setSource ( $source = null )
setTarget ( $target )
translate ( $text ) : string

Méthodes protégées

Méthode Description
getApiKey ( ) : string Returns the api key from the configuration.
getSource ( ) : string Returns the source language.
getTarget ( ) : string Returns the target language.
parseResponse ( array $contents ) : mixed Extract and decode the translation response.

Method Details

__construct() public méthode

public __construct ( Illuminate\Contracts\Foundation\Application $app, GuzzleHttp\ClientInterface $client )
$app Illuminate\Contracts\Foundation\Application
$client GuzzleHttp\ClientInterface

getApiKey() protected méthode

Returns the api key from the configuration.
protected getApiKey ( ) : string
Résultat string

getSource() protected méthode

Returns the source language.
protected getSource ( ) : string
Résultat string

getTarget() protected méthode

Returns the target language.
protected getTarget ( ) : string
Résultat string

parseResponse() protected méthode

Extract and decode the translation response.
protected parseResponse ( array $contents ) : mixed
$contents array
Résultat mixed

setSource() public méthode

public setSource ( $source = null )

setTarget() public méthode

public setTarget ( $target )

translate() public méthode

public translate ( $text ) : string
$text
Résultat string

Property Details

$client protected_oe property

protected ClientInterface,GuzzleHttp $client
Résultat GuzzleHttp\ClientInterface

$config protected_oe property

Holds the current config instance.
protected $config

$endpoint protected_oe property

API endpoint
protected $endpoint

$source protected_oe property

source language
protected $source

$target protected_oe property

target language
protected $target