UploadFileParameters.php in TMGMT Translator Smartling 8.4
File
vendor/smartling/api-sdk-php/src/File/Params/UploadFileParameters.php
View source
<?php
namespace Smartling\File\Params;
use Smartling\BaseApiAbstract;
use Smartling\Parameters\BaseParameters;
class UploadFileParameters extends BaseParameters {
public function __construct($clientLibId = BaseApiAbstract::CLIENT_LIB_ID_SDK, $clientLibVersion = BaseApiAbstract::CLIENT_LIB_ID_VERSION) {
$this
->setAuthorized(false);
$this
->setClientLibId($clientLibId, $clientLibVersion);
}
public function setClientLibId($client_lib_id, $version) {
$this
->set('smartling.client_lib_id', json_encode([
'client' => $client_lib_id,
'version' => $version,
], JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE));
return $this;
}
public function setCallbackUrl($callback_url) {
$this
->set('callbackUrl', $callback_url);
return $this;
}
public function setAuthorized($authorized) {
$this
->set('authorize', $authorized);
return $this;
}
public function setLocalesToApprove($locales_to_approve) {
if (is_string($locales_to_approve)) {
$locales_to_approve = [
$locales_to_approve,
];
}
$this
->set('localeIdsToAuthorize', $locales_to_approve);
return $this;
}
public function exportToArray() {
$params = $this->params;
$params['authorize'] = array_key_exists('localeIdsToAuthorize', $params) ? false : (bool) $params['authorize'];
return $params;
}
}