You are here

public function ContextApi::wait in TMGMT Translator Smartling 8.3

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.2 api-sdk-php/src/Context/ContextApi.php \Smartling\Context\ContextApi::wait()
  3. 8.2 vendor/smartling/api-sdk-php/src/Context/ContextApi.php \Smartling\Context\ContextApi::wait()

Makes async operation sync.

Parameters

array $data:

Throws

SmartlingApiException

Overrides Waitable::wait

2 calls to ContextApi::wait()
ContextApi::matchContextSync in vendor/smartling/api-sdk-php/src/Context/ContextApi.php
Match context 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 34

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');
  }
}