You are here

function addFileToJobDemo 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 \addFileToJobDemo()

Parameters

\Smartling\AuthApi\AuthApiInterface $authProvider:

string $projectId:

string $jobId:

string $fileUri:

Return value

mixed

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

File

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

Code

function addFileToJobDemo($authProvider, $projectId, $jobId, $fileUri) {
  echo "--- Add file to a job ---\n";
  $jobs = \Smartling\Jobs\JobsApi::create($authProvider, $projectId);
  $params = new AddFileToJobParameters();
  $params
    ->setFileUri($fileUri);
  $st = microtime(true);
  try {
    $jobs
      ->addFileToJobSync($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",
  ]);
}