@@ -39,9 +39,9 @@ class Configuration
39
39
40
40
public function setConfig($config = array())
41
41
{
42
- $apiKey = isset( $config [' apiKey' ]) ? $ config [ ' apiKey ' ] : ' ' ;
43
- $accessToken = isset( $config [' accessToken' ]) ? $ config [ ' accessToken ' ] : ' ' ;
44
- $server = isset( $config [' server' ]) ? $ config [ ' server ' ] : ' invalid-server' ;
42
+ $apiKey = $config [' apiKey' ] ?? ' ' ;
43
+ $accessToken = $config [' accessToken' ] ?? ' ' ;
44
+ $server = $config [' server' ] ?? ' invalid-server' ;
45
45
$host = str_replace(' server' , $server , $this -> getHost ());
46
46
47
47
// Basic Authentication
@@ -72,7 +72,7 @@ class Configuration
72
72
73
73
public function getApiKey($apiKeyIdentifier)
74
74
{
75
- return isset( $this -> apiKeys [$apiKeyIdentifier ]) ? $ this -> apiKeys [ $ apiKeyIdentifier ] : null;
75
+ return $this -> apiKeys [$apiKeyIdentifier ] ?? null;
76
76
}
77
77
78
78
public function setApiKeyPrefix($apiKeyIdentifier, $prefix)
@@ -83,7 +83,7 @@ class Configuration
83
83
84
84
public function getApiKeyPrefix($apiKeyIdentifier)
85
85
{
86
- return isset( $this -> apiKeyPrefixes [$apiKeyIdentifier ]) ? $ this -> apiKeyPrefixes [ $ apiKeyIdentifier ] : null;
86
+ return $this -> apiKeyPrefixes [$apiKeyIdentifier ] ?? null;
87
87
}
88
88
89
89
public function setAccessToken($accessToken)
@@ -218,19 +218,14 @@ class Configuration
218
218
219
219
public function getApiKeyWithPrefix($apiKeyIdentifier)
220
220
{
221
- $prefix = $this -> getApiKeyPrefix ($apiKeyIdentifier );
222
221
$apiKey = $this -> getApiKey ($apiKeyIdentifier );
223
222
224
223
if ($apiKey === null) {
225
224
return null;
226
225
}
227
226
228
- if ($prefix === null) {
229
- $keyWithPrefix = $apiKey ;
230
- } else {
231
- $keyWithPrefix = $prefix . ' ' . $apiKey ;
232
- }
227
+ $prefix = $this->getApiKeyPrefix($apiKeyIdentifier);
233
228
234
- return $keyWithPrefix ;
229
+ return $prefix === null ? $apiKey : $prefix . ' ' . $apiKey ;
235
230
}
236
231
}
0 commit comments