Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace global 'version' variable with Configuration::VERSION class constant #32

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,14 @@
* @link https://github.com/swagger-api/swagger-codegen
*/

$GLOBALS['version'] = '2.0.0';

class Configuration
{
/**
* Version of the package
*/
const VERSION = '2.0.0';

private static $defaultConfiguration;

/**
Expand Down Expand Up @@ -120,7 +124,7 @@ class Configuration
public function __construct()
{
$this->tempFolderPath = sys_get_temp_dir();
$this->userAgent = 'brevo_clientAPI/v' . $GLOBALS['version'] . '/php';
$this->userAgent = 'brevo_clientAPI/v' . self::VERSION . '/php';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is the only place where the VERSION constant is used, isn't it better to just write down the full string?

Suggested change
$this->userAgent = 'brevo_clientAPI/v' . self::VERSION . '/php';
$this->userAgent = 'brevo_clientAPI/v2.0.0/php';

}

/**
Expand Down