function createBatchDemo in TMGMT Translator Smartling 8.4
Same name and namespace in other branches
- 8.3 vendor/smartling/api-sdk-php/examples/batch-example.php \createBatchDemo()
Parameters
\Smartling\AuthApi\AuthApiInterface $authProvider:
string $projectId:
Return value
bool
1 call to createBatchDemo()
- batch-example.php in vendor/
smartling/ api-sdk-php/ examples/ batch-example.php
File
- vendor/
smartling/ api-sdk-php/ examples/ batch-example.php, line 54
Code
function createBatchDemo($authProvider, $projectId, $jobId) {
echo "--- Create Batch ---\n";
$response = [];
$batchApi = BatchApi::create($authProvider, $projectId);
$createBatchParameters = new CreateBatchParameters();
$createBatchParameters
->setTranslationJobUid($jobId);
$createBatchParameters
->setAuthorize(true);
$st = microtime(true);
try {
$response = $batchApi
->createBatch($createBatchParameters);
} 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;
}