Skip to content

Commit

Permalink
Merge branch 'feature/typing'
Browse files Browse the repository at this point in the history
  • Loading branch information
earthiverse committed Jan 20, 2025
2 parents 18b3def + d3b3fa9 commit 4f54049
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
19 changes: 7 additions & 12 deletions swagger-config/marketing/php/templates/Configuration.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ class Configuration

public function setConfig($config = array())
{
$apiKey = isset($config['apiKey']) ? $config['apiKey'] : '';
$accessToken = isset($config['accessToken']) ? $config['accessToken'] : '';
$server = isset($config['server']) ? $config['server'] : 'invalid-server';
$apiKey = $config['apiKey'] ?? '';
$accessToken = $config['accessToken'] ?? '';
$server = $config['server'] ?? 'invalid-server';
$host = str_replace('server', $server, $this->getHost());
// Basic Authentication
Expand Down Expand Up @@ -72,7 +72,7 @@ class Configuration

public function getApiKey($apiKeyIdentifier)
{
return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null;
return $this->apiKeys[$apiKeyIdentifier] ?? null;
}

public function setApiKeyPrefix($apiKeyIdentifier, $prefix)
Expand All @@ -83,7 +83,7 @@ class Configuration

public function getApiKeyPrefix($apiKeyIdentifier)
{
return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null;
return $this->apiKeyPrefixes[$apiKeyIdentifier] ?? null;
}

public function setAccessToken($accessToken)
Expand Down Expand Up @@ -218,19 +218,14 @@ class Configuration

public function getApiKeyWithPrefix($apiKeyIdentifier)
{
$prefix = $this->getApiKeyPrefix($apiKeyIdentifier);
$apiKey = $this->getApiKey($apiKeyIdentifier);
if ($apiKey === null) {
return null;
}

if ($prefix === null) {
$keyWithPrefix = $apiKey;
} else {
$keyWithPrefix = $prefix . ' ' . $apiKey;
}
$prefix = $this->getApiKeyPrefix($apiKeyIdentifier);

return $keyWithPrefix;
return $prefix === null ? $apiKey : $prefix . ' ' . $apiKey;
}
}
2 changes: 1 addition & 1 deletion swagger-config/marketing/php/templates/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use {{invokerPackage}}\ObjectSerializer;
protected $config;
protected $headerSelector;
public function __construct(Configuration $config = null)
public function __construct(?Configuration $config = null)
{
$this->client = new Client([
'defaults' => [
Expand Down
2 changes: 1 addition & 1 deletion swagger-config/transactional/php/templates/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use {{invokerPackage}}\ObjectSerializer;
{
protected $config;
public function __construct(Configuration $config = null)
public function __construct(?Configuration $config = null)
{
$this->config = $config ?: new Configuration();
}
Expand Down

0 comments on commit 4f54049

Please sign in to comment.