You are here

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

Get all missing resources.

Return value

array Contains next keys:

  • "items": array of missing resources
  • "all": boolean which indicates whether function has read all the available items or not.

Throws

SmartlingApiException

File

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

Class

ContextApi
Class ContextApi

Namespace

Smartling\Context

Code

public function getAllMissingResources() {
  $missingResources = [];
  $offset = FALSE;
  $all = TRUE;
  $start_time = time();
  while (!is_null($offset)) {
    $delta = time() - $start_time;
    if ($delta > $this
      ->getTimeOut()) {
      $all = FALSE;
      break;
    }
    if (!$offset) {
      $params = NULL;
    }
    else {
      $params = new MissingResourcesParameters();
      $params
        ->setOffset($offset);
    }
    $response = $this
      ->getMissingResources($params);
    $offset = !empty($response['offset']) ? $response['offset'] : NULL;
    $missingResources = array_merge($missingResources, $response['items']);
  }
  return [
    'items' => $missingResources,
    'all' => $all,
  ];
}