You are here

public function ContextApi::wait in TMGMT Translator Smartling 8.2

Same name in this branch
  1. 8.2 api-sdk-php/src/Context/ContextApi.php \Smartling\Context\ContextApi::wait()
  2. 8.2 vendor/smartling/api-sdk-php/src/Context/ContextApi.php \Smartling\Context\ContextApi::wait()
Same name and namespace in other branches
  1. 8.4 vendor/smartling/api-sdk-php/src/Context/ContextApi.php \Smartling\Context\ContextApi::wait()
  2. 8.3 vendor/smartling/api-sdk-php/src/Context/ContextApi.php \Smartling\Context\ContextApi::wait()

Makes async operation sync.

Parameters

array $data:

Throws

SmartlingApiException

4 calls to ContextApi::wait()
ContextApi::matchContextSync in api-sdk-php/src/Context/ContextApi.php
Match context sync.
ContextApi::matchContextSync in vendor/smartling/api-sdk-php/src/Context/ContextApi.php
Match context sync.
ContextApi::uploadAndMatchContextSync in api-sdk-php/src/Context/ContextApi.php
Upload and match sync.
ContextApi::uploadAndMatchContextSync in vendor/smartling/api-sdk-php/src/Context/ContextApi.php
Upload and match sync.

File

vendor/smartling/api-sdk-php/src/Context/ContextApi.php, line 33

Class

ContextApi
Class ContextApi

Namespace

Smartling\Context

Code

public function wait(array $data) {
  if (!empty($data['matchId'])) {
    $start_time = time();
    do {
      $delta = time() - $start_time;
      if ($delta > $this
        ->getTimeOut()) {
        throw new SmartlingApiException(vsprintf('Async operation is not completed after %s seconds.', [
          $delta,
        ]));
      }
      sleep(1);
      $result = $this
        ->getMatchStatus($data['matchId']);
    } while ($result['status'] != 'COMPLETED');
  }
}