You are here

function cancelJobDemo in TMGMT Translator Smartling 8.3

Same name and namespace in other branches
  1. 8.4 vendor/smartling/api-sdk-php/examples/jobs-example.php \cancelJobDemo()

Parameters

\Smartling\AuthApi\AuthApiInterface $authProvider:

string $projectId:

string $jobId:

Return value

string

1 call to cancelJobDemo()
jobs-example.php in vendor/smartling/api-sdk-php/examples/jobs-example.php

File

vendor/smartling/api-sdk-php/examples/jobs-example.php, line 164

Code

function cancelJobDemo($authProvider, $projectId, $jobId) {
  echo "--- Cancel job ---\n";
  $jobs = \Smartling\Jobs\JobsApi::create($authProvider, $projectId);
  $params = new \Smartling\Jobs\Params\CancelJobParameters();
  $params
    ->setReason('Some reason to cancel');
  $st = microtime(true);
  try {
    $jobs
      ->cancelJobSync($jobId, $params);
  } 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",
  ]);
}