You are here

public function SmartlingApiException::getErrorsByKey in TMGMT Translator Smartling 8.2

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

Get list of errors by specified key.

Parameters

string $key:

Return value

array

Throws

\Exception

File

vendor/smartling/api-sdk-php/src/Exceptions/SmartlingApiException.php, line 71

Class

SmartlingApiException
Class SmartlingApiException @package Smartling\Exceptions

Namespace

Smartling\Exceptions

Code

public function getErrorsByKey($key) {
  if (!is_string($key)) {
    throw new \Exception('Key must be a string');
  }
  $errors = array_filter($this->errors, function ($el) use ($key) {
    return $el['key'] === $key;
  });
  return $errors;
}