@@ -41,9 +41,9 @@ class Configuration
4141
4242 public function setConfig($config = array())
4343 {
44- $apiKey = isset( $config [' apiKey' ]) ? $ config [ ' apiKey ' ] : ' ' ;
45- $accessToken = isset( $config [' accessToken' ]) ? $ config [ ' accessToken ' ] : ' ' ;
46- $server = isset( $config [' server' ]) ? $ config [ ' server ' ] : ' invalid-server' ;
44+ $apiKey = $config [' apiKey' ] ?? ' ' ;
45+ $accessToken = $config [' accessToken' ] ?? ' ' ;
46+ $server = $config [' server' ] ?? ' invalid-server' ;
4747 $host = str_replace(' server' , $server , $this -> getHost ());
4848
4949 // Basic Authentication
@@ -74,7 +74,7 @@ class Configuration
7474
7575 public function getApiKey($apiKeyIdentifier)
7676 {
77- return isset( $this -> apiKeys [$apiKeyIdentifier ]) ? $ this -> apiKeys [ $ apiKeyIdentifier ] : null;
77+ return $this -> apiKeys [$apiKeyIdentifier ] ?? null;
7878 }
7979
8080 public function setApiKeyPrefix($apiKeyIdentifier, $prefix)
@@ -85,7 +85,7 @@ class Configuration
8585
8686 public function getApiKeyPrefix($apiKeyIdentifier)
8787 {
88- return isset( $this -> apiKeyPrefixes [$apiKeyIdentifier ]) ? $ this -> apiKeyPrefixes [ $ apiKeyIdentifier ] : null;
88+ return $this -> apiKeyPrefixes [$apiKeyIdentifier ] ?? null;
8989 }
9090
9191 public function setAccessToken($accessToken)
@@ -220,19 +220,14 @@ class Configuration
220220
221221 public function getApiKeyWithPrefix($apiKeyIdentifier)
222222 {
223- $prefix = $this -> getApiKeyPrefix ($apiKeyIdentifier );
224223 $apiKey = $this -> getApiKey ($apiKeyIdentifier );
225224
226225 if ($apiKey === null) {
227226 return null;
228227 }
229228
230- if ($prefix === null) {
231- $keyWithPrefix = $apiKey ;
232- } else {
233- $keyWithPrefix = $prefix . ' ' . $apiKey ;
234- }
229+ $prefix = $this->getApiKeyPrefix($apiKeyIdentifier);
235230
236- return $keyWithPrefix ;
231+ return $prefix === null ? $apiKey : $prefix . ' ' . $apiKey ;
237232 }
238233}
0 commit comments