Skip to content

Commit

Permalink
fix code style
Browse files Browse the repository at this point in the history
  • Loading branch information
anton committed Oct 14, 2024
1 parent 8d0fc91 commit 7db5256
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## v3.6.12
* Добавлена передача версий модуля, php и cms в get-запросах к CRM
* Добавлена передача дополнительных параметров в GET запросах

## v3.6.11
* Добавлены подсказки в настройках модуля
Expand Down
22 changes: 9 additions & 13 deletions retailcrm/lib/api/RetailcrmHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class RetailcrmHttpClient

protected $url;
protected $defaultParameters;
protected $versionData;

/**
* Client constructor.
Expand All @@ -62,13 +61,7 @@ public function __construct($url, array $defaultParameters = [])
}

$this->url = $url;
$this->defaultParameters = $defaultParameters;
$this->versionData = [
'php_version' => function_exists('phpversion') ? phpversion() : '',
'cms_source' => 'PrestaShop',
'module_version' => RetailCRM::VERSION,
'cms_version' => _PS_VERSION_
];
$this->defaultParameters = $defaultParameters;
}

/**
Expand Down Expand Up @@ -113,11 +106,14 @@ public function makeRequest(
);
}

if (self::METHOD_GET === $method) {
$parameters = array_merge($this->defaultParameters, $parameters, $this->versionData);
} else {
$parameters = array_merge($this->defaultParameters, $parameters);
}
$parameters = self::METHOD_GET === $method
? array_merge($this->defaultParameters, $parameters, [
'php_version' => function_exists('phpversion') ? phpversion() : '',
'cms_source' => 'PrestaShop',
'module_version' => RetailCRM::VERSION,
'cms_version' => _PS_VERSION_,
])
: $parameters = array_merge($this->defaultParameters, $parameters);

$url = $this->url . $path;

Expand Down

0 comments on commit 7db5256

Please sign in to comment.