1
0
Fork 0
mirror of synced 2025-04-02 21:36:14 +03:00

fix code style

This commit is contained in:
anton 2024-10-14 19:37:43 +06:00
parent b77e9a6dc1
commit f469153a0b
3 changed files with 13 additions and 17 deletions

View file

@ -1,5 +1,5 @@
## 2024-10-14 4.8.11
* Add parameters with versions of PHP, module, wordpress, woocommerce
* Added additional parameters to GET requests
## 2024-10-08 4.8.10
* Fixed errors in catalog formation when changing synchronization parameters (sku/externalId)

View file

@ -26,7 +26,6 @@ class WC_Retailcrm_Request
protected $url;
protected $defaultParameters;
protected $versionData;
/**
* Client constructor.
@ -39,13 +38,6 @@ class WC_Retailcrm_Request
{
$this->url = $url;
$this->defaultParameters = $defaultParameters;
$this->versionData = [
'php_version' => function_exists('phpversion') ? phpversion() : '',
'cms_source' => 'Woocommerce',
'module_version' => WC_Integration_Retailcrm::MODULE_VERSION,
'woocommerce_version' => WC()->version ?? '',
'cms_version' => function_exists('get_bloginfo') ? get_bloginfo('version') : ''
];
}
/**
@ -65,9 +57,9 @@ class WC_Retailcrm_Request
public function makeRequest(
$path,
$method,
array $parameters = array()
array $parameters = []
) {
$allowedMethods = array(self::METHOD_GET, self::METHOD_POST);
$allowedMethods = [self::METHOD_GET, self::METHOD_POST];
if (!in_array($method, $allowedMethods, false)) {
throw new \InvalidArgumentException(
@ -79,11 +71,15 @@ class WC_Retailcrm_Request
);
}
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' => 'Woocommerce',
'module_version' => WC_Integration_Retailcrm::MODULE_VERSION,
'woocommerce_version' => WC()->version ?? '',
'cms_version' => function_exists('get_bloginfo') ? get_bloginfo('version') : '',
])
: $parameters = array_merge($this->defaultParameters, $parameters);
$url = $this->url . $path;

View file

@ -84,7 +84,7 @@ Asegúrate de tener una clave API específica para cada tienda. Las siguientes i
== Changelog ==
= 4.8.11 =
* Add parameters with versions of PHP, module, wordpress, woocommerce
* Added additional parameters to GET requests
= 4.8.10 =
* Fixed errors in catalog formation when changing synchronization parameters (sku/externalId)