public function __construct($source = null, $target = 'en', $options = [], TokenProviderInterface $tokener = null)
{
$this->httpClient = new GuzzleHttpClient($options);
// Create HTTP client
$this->setSource($source)->setTarget($target);
// Set languages
$this::$lastDetectedSource = false;
if (!isset($tokener)) {
$tokener = $this->defaultTokenProvider;
}
$tokenProviderReflection = new ReflectionClass($tokener);
if ($tokenProviderReflection->implementsInterface(TokenProviderInterface::class)) {
$this->tokenProvider = $tokenProviderReflection->newInstance();
} else {
throw new Exception('Token provider should implement TokenProviderInterface');
}
}