public function __call($name, $args)
{
switch ($name) {
case 'translate':
if (count($args) < 1) {
throw new InvalidArgumentException('Expecting 1 parameter');
}
try {
$result = $this->instanceTranslate($args[0]);
} catch (Exception $e) {
throw $e;
}
return $result;
case 'getLastDetectedSource':
return $this::staticGetLastDetectedSource();
case 'getResponse':
// getResponse is available for instanse calls only.
return $this->getResponse($args[0]);
default:
throw new BadMethodCallException("Method [{$name}] does not exist");
}
}