public function __construct(array $data)
{
foreach (array('client_id', 'authorize_endpoint', 'token_endpoint') as $key) {
if (!array_key_exists($key, $data)) {
throw new ClientConfigException(sprintf("missing field '%s'", $key));
}
}
$this->setClientId($data['client_id']);
$this->setAuthorizeEndpoint($data['authorize_endpoint']);
$this->setTokenEndpoint($data['token_endpoint']);
$clientSecret = array_key_exists('client_secret', $data) ? $data['client_secret'] : null;
$this->setClientSecret($clientSecret);
$redirectUri = array_key_exists('redirect_uri', $data) ? $data['redirect_uri'] : null;
$this->setRedirectUri($redirectUri);
$credentialsInRequestBody = array_key_exists('credentials_in_request_body', $data) ? $data['credentials_in_request_body'] : false;
$this->setCredentialsInRequestBody($credentialsInRequestBody);
$defaultTokenType = array_key_exists('default_token_type', $data) ? $data['default_token_type'] : null;
$this->setDefaultTokenType($defaultTokenType);
$allowNullExpiresIn = array_key_exists('allow_null_expires_in', $data) ? $data['allow_null_expires_in'] : false;
$this->setAllowNullExpiresIn($allowNullExpiresIn);
$useRedirectUriOnRefreshTokenRequest = array_key_exists('use_redirect_uri_on_refresh_token_request', $data) ? $data['use_redirect_uri_on_refresh_token_request'] : false;
$this->setUseRedirectUriOnRefreshTokenRequest($useRedirectUriOnRefreshTokenRequest);
$defaultServerScope = array_key_exists('default_server_scope', $data) ? $data['default_server_scope'] : null;
$this->setDefaultServerScope($defaultServerScope);
$useCommaSeparatedScope = array_key_exists('use_comma_separated_scope', $data) ? $data['use_comma_separated_scope'] : null;
$this->setUseCommaSeparatedScope($useCommaSeparatedScope);
$useArrayScope = array_key_exists('use_array_scope', $data) ? $data['use_array_scope'] : null;
$this->setUseArrayScope($useArrayScope);
$enableDebug = array_key_exists('enable_debug', $data) ? $data['enable_debug'] : false;
$this->setEnableDebug($enableDebug);
$allowStringExpiresIn = array_key_exists('allow_string_expires_in', $data) ? $data['allow_string_expires_in'] : false;
$this->setAllowStringExpiresIn($allowStringExpiresIn);
}