You are here

public function TranslationSubmissionParamsAbstract::setState in TMGMT Translator Smartling 8.3

Same name and namespace in other branches
  1. 8.4 vendor/smartling/api-sdk-php/src/TranslationRequests/Params/TranslationSubmissionParamsAbstract.php \Smartling\TranslationRequests\Params\TranslationSubmissionParamsAbstract::setState()

Parameters

$state:

Return value

$this

File

vendor/smartling/api-sdk-php/src/TranslationRequests/Params/TranslationSubmissionParamsAbstract.php, line 25

Class

TranslationSubmissionParamsAbstract
Class TranslationSubmissionParamsAbstract @package Smartling\TranslationRequests\Params

Namespace

Smartling\TranslationRequests\Params

Code

public function setState($state) {
  $state = (string) $state;
  if (in_array($state, TranslationSubmissionStates::$allowedStates, true)) {
    $this
      ->set('state', $state);
  }
  else {
    throw new \UnexpectedValueException(vsprintf('Invalid \'state\' value \'%s\', expected one of: %s', [
      $state,
      implode('|', TranslationSubmissionStates::$allowedStates),
    ]));
  }
  return $this;
}