private function BaseApiAbstract::checkAuthenticationError in TMGMT Translator Smartling 8.2
Same name in this branch
- 8.2 api-sdk-php/src/BaseApiAbstract.php \Smartling\BaseApiAbstract::checkAuthenticationError()
- 8.2 vendor/smartling/api-sdk-php/src/BaseApiAbstract.php \Smartling\BaseApiAbstract::checkAuthenticationError()
Same name and namespace in other branches
- 8.4 vendor/smartling/api-sdk-php/src/BaseApiAbstract.php \Smartling\BaseApiAbstract::checkAuthenticationError()
- 8.3 vendor/smartling/api-sdk-php/src/BaseApiAbstract.php \Smartling\BaseApiAbstract::checkAuthenticationError()
Parameters
Response $response:
Throws
2 calls to BaseApiAbstract::checkAuthenticationError()
- BaseApiAbstract::sendRequest in api-sdk-php/
src/ BaseApiAbstract.php - BaseApiAbstract::sendRequest in vendor/
smartling/ api-sdk-php/ src/ BaseApiAbstract.php
File
- api-sdk-php/
src/ BaseApiAbstract.php, line 337
Class
- BaseApiAbstract
- Class BaseApiAbstract
Namespace
SmartlingCode
private function checkAuthenticationError(Response $response) {
//Special handling for 401 error - authentication error => expire token
if (401 === (int) $response
->getStatusCode()) {
if (!$this
->getAuth() instanceof AuthApiInterface) {
$type = gettype($this
->getAuth());
if ('object' === $type) {
$type .= '::' . get_class($this
->getAuth());
}
throw new SmartlingApiException('AuthProvider expected to be instance of AuthApiInterface, type given:' . $type, 401);
}
else {
$this
->getAuth()
->resetToken();
}
}
}