function renderContextDemo in TMGMT Translator Smartling 8.4
Same name and namespace in other branches
- 8.2 api-sdk-php/examples/context-example.php \renderContextDemo()
- 8.2 vendor/smartling/api-sdk-php/examples/context-example.php \renderContextDemo()
- 8.3 vendor/smartling/api-sdk-php/examples/context-example.php \renderContextDemo()
Parameters
\Smartling\AuthApi\AuthApiInterface $authProvider:
string $projectId:
string $contextUid:
Return value
array
1 call to renderContextDemo()
- context-example.php in vendor/smartling/ api-sdk-php/ examples/ context-example.php 
File
- vendor/smartling/ api-sdk-php/ examples/ context-example.php, line 283 
Code
function renderContextDemo($authProvider, $projectId, $contextUid) {
  $response = FALSE;
  $context = \Smartling\Context\ContextApi::create($authProvider, $projectId);
  $st = microtime(true);
  try {
    $response = $context
      ->renderContext($contextUid);
  } catch (\Smartling\Exceptions\SmartlingApiException $e) {
    var_dump($e
      ->getErrors());
  }
  $et = microtime(TRUE);
  $time = $et - $st;
  echo vsprintf('Request took %s seconds.%s', [
    round($time, 3),
    "\n\r",
  ]);
  if (!empty($response)) {
    var_dump($response);
  }
  return $response;
}