@@ -39,9 +39,9 @@ class Configuration
3939
4040 public function setConfig($config = array())
4141 {
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' ;
4545 $host = str_replace(' server' , $server , $this -> getHost ());
4646
4747 // Basic Authentication
@@ -72,7 +72,7 @@ class Configuration
7272
7373 public function getApiKey($apiKeyIdentifier)
7474 {
75- return isset( $this -> apiKeys [$apiKeyIdentifier ]) ? $ this -> apiKeys [ $ apiKeyIdentifier ] : null;
75+ return $this -> apiKeys [$apiKeyIdentifier ] ?? null;
7676 }
7777
7878 public function setApiKeyPrefix($apiKeyIdentifier, $prefix)
@@ -83,7 +83,7 @@ class Configuration
8383
8484 public function getApiKeyPrefix($apiKeyIdentifier)
8585 {
86- return isset( $this -> apiKeyPrefixes [$apiKeyIdentifier ]) ? $ this -> apiKeyPrefixes [ $ apiKeyIdentifier ] : null;
86+ return $this -> apiKeyPrefixes [$apiKeyIdentifier ] ?? null;
8787 }
8888
8989 public function setAccessToken($accessToken)
@@ -218,19 +218,14 @@ class Configuration
218218
219219 public function getApiKeyWithPrefix($apiKeyIdentifier)
220220 {
221- $prefix = $this -> getApiKeyPrefix ($apiKeyIdentifier );
222221 $apiKey = $this -> getApiKey ($apiKeyIdentifier );
223222
224223 if ($apiKey === null) {
225224 return null;
226225 }
227226
228- if ($prefix === null) {
229- $keyWithPrefix = $apiKey ;
230- } else {
231- $keyWithPrefix = $prefix . ' ' . $apiKey ;
232- }
227+ $prefix = $this->getApiKeyPrefix($apiKeyIdentifier);
233228
234- return $keyWithPrefix ;
229+ return $prefix === null ? $apiKey : $prefix . ' ' . $apiKey ;
235230 }
236231}
0 commit comments