public function LingotekApi::getProject in Lingotek Translation 8
Same name and namespace in other branches
- 8.2 src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::getProject()
- 4.0.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::getProject()
- 3.0.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::getProject()
- 3.1.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::getProject()
- 3.2.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::getProject()
- 3.3.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::getProject()
- 3.4.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::getProject()
- 3.5.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::getProject()
- 3.6.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::getProject()
- 3.7.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::getProject()
- 3.8.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::getProject()
File
- src/
Remote/ LingotekApi.php, line 293 - Contains \Drupal\lingotek\Remote\LingotekApi.
Class
Namespace
Drupal\lingotek\RemoteCode
public function getProject($project_id) {
try {
$this->logger
->debug('Lingotek::getProject called with id ' . $project_id);
$response = $this->lingotekClient
->get('/api/project/' . $project_id);
} catch (\Exception $e) {
$this->logger
->error('Error getting project %project: %message.', [
'%project' => $project_id,
'%message' => $e
->getMessage(),
]);
throw new LingotekApiException('Failed to get project: ' . $e
->getMessage());
}
$this->logger
->debug('getProject response received, code %code and body %body', [
'%code' => $response
->getStatusCode(),
'%body' => (string) $response
->getBody(TRUE),
]);
return $response
->json();
}