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YVlyuQ07AcCIipsT8 K0ZRhjk2Z/2rLWa3uZoEaQN4AsD9w5Fqum+TctMKvhHhZ+Wp0x9gUa2SRgFbXvHo tSHblRU1svCAEK3bE43McPvYq2rndKwGJDFeWI7EfaKjZOWzaMRfISz0KeFgZ26E 08d3rQA9TbV4YckUPOKF5Lj21UYY3MHIUuTC/MBSofcgMhYSHgNPwLjxBCOhlzv/ ycZUFlVUIrc1H4Fw9JgHLTdqmu8BnDc5gJpuEK4bycsxKDKmGtMRnY/fVd2w3GxZ /UlS2WSbYBtjl7EFTIWHTG95Ns2+5qs86w40kwVCJDDspwoEM9U6nJhULAwbmCgj Nw32s/+D/eojBlS6LOLPWBS5LUGUagFzBMoaanHCqtow3ivJ4fwA6pdCF3Ks9thg QzboJNOQ7osBU4Fw1WXqf9KCyu/o95q43iEz1eoicIonucfdHdWTZHuNUfAjdCGk Jd4kXkd75toobxaFM5yf0UXI2VltMpG5KwBhRXmrw7EOMSJHoGk= =jR9h -----END PGP SIGNATURE----- Merge tag '3.0.3' 3.0.3
This commit is contained in:
commit
70043b227c
7 changed files with 667 additions and 547 deletions
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": "3.0.2",
|
||||
"version": "3.0.3",
|
||||
"timestampTimeout": 30,
|
||||
"apiRequestRatePerMinute": 256,
|
||||
"servicesDBCache": 10
|
||||
|
|
|
|||
|
|
@ -2,6 +2,12 @@
|
|||
|
||||
### All notable changes to `CRM CLient V2` will be documented in this file.
|
||||
|
||||
# version 3.0.3
|
||||
- Update Country enum
|
||||
- Fixed : request merge method of data to query (Request.php)
|
||||
- Fixed : validate json check should check if really false (Response.php)
|
||||
- Bumped composer deps
|
||||
|
||||
# version 3.0.2
|
||||
- Regen documentation with php documentor
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
"type": "library",
|
||||
"description": "LDC CRM Client V2",
|
||||
"license": "MIT",
|
||||
"version": "3.0.1",
|
||||
"version": "3.0.3",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jérémy Munsch",
|
||||
|
|
@ -40,5 +40,10 @@
|
|||
"psr-4": {
|
||||
"LDC\\LDCCRM\\Tests\\": "tests"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
1096
composer.lock
generated
1096
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -781,4 +781,89 @@ class Country extends BaseEnum
|
|||
'zimbabwe' => 'Zimbabwe'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get valid countries label
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getValidCountriesLabel(): array
|
||||
{
|
||||
return collect(self::getValidCountries())->map(function (self $country) {
|
||||
return $country->label;
|
||||
})->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Alpha 2 ISO code of valid countries
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getValidIsoAplha2Codes(): array
|
||||
{
|
||||
return \array_values(self::isoCodes());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get valid countries
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getValidCountries(): array
|
||||
{
|
||||
return [
|
||||
Country::belgium(),
|
||||
Country::luxembourg(),
|
||||
Country::france(),
|
||||
// * DROM COM.
|
||||
Country::guadeloupe(),
|
||||
Country::martinique(),
|
||||
Country::frenchGuiana(),
|
||||
Country::reunion(),
|
||||
Country::saintPierreAndMiquelon(),
|
||||
Country::mayotte(),
|
||||
Country::saintBarthelemy(),
|
||||
Country::saintMartinFrenchPart(),
|
||||
Country::wallisAndFutuna(),
|
||||
Country::frenchPolynesia(),
|
||||
Country::newCaledonia()
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum classes
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function isoCodes(): array
|
||||
{
|
||||
return [
|
||||
'france' => 'FR',
|
||||
'belgium' => 'BE',
|
||||
'luxembourg' => 'LU',
|
||||
'guadeloupe' => 'GP',
|
||||
'martinique' => 'MQ',
|
||||
'frenchGuiana' => 'GF',
|
||||
'reunion' => 'RE',
|
||||
'saintPierreAndMiquelon' => 'PM',
|
||||
'mayotte' => 'YT',
|
||||
'saintBarthelemy' => 'BL',
|
||||
'saintMartinFrenchPart' => 'MF',
|
||||
'wallisAndFutuna' => 'WF',
|
||||
'frenchPolynesia' => 'PF',
|
||||
'newCaledonia' => 'NC',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $attribute
|
||||
* @return integer|string
|
||||
*/
|
||||
public function __get(string $attribute)
|
||||
{
|
||||
if ($attribute === 'iso') {
|
||||
return $this->isoCodes()[$this->getDefinition()] ?? null;
|
||||
}
|
||||
return parent::__get($attribute);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,8 +128,22 @@ class Request
|
|||
{
|
||||
$this->request = function () {
|
||||
$uri = $this->uri;
|
||||
// * If query merge query and data, set data to empty.
|
||||
if ($this->method->equals(HttpMethods::get())) {
|
||||
$uri = sprintf("%s?%s", $uri, http_build_query($this->data));
|
||||
// * Merge query in url with Data
|
||||
$q = \parse_url($uri, \PHP_URL_QUERY) ?? '';
|
||||
$q = \strpos($q, '&') !== false ? explode('&', $q) : [];
|
||||
$query = [];
|
||||
foreach ($q as $qParam) {
|
||||
$qParam = explode('=', $qParam, 2);
|
||||
|
||||
$query[$qParam[0]] = $qParam[1];
|
||||
}
|
||||
// * Remove query part.
|
||||
$uri = strtok($uri, '?');
|
||||
// * Append build query
|
||||
$uri = sprintf("%s?%s", $uri, http_build_query(array_merge($query, $this->data)));
|
||||
|
||||
$this->data = [];
|
||||
}
|
||||
$request = new Psr7Request(
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ class Response
|
|||
}
|
||||
|
||||
// * Body should be json data.
|
||||
if (!($decodedJson = $this->tryDecodeJson($this->body->getContents()))) {
|
||||
if (($decodedJson = $this->tryDecodeJson($this->body->getContents())) === false) {
|
||||
if (Utils::getConfig('app.env') === 'testing') {
|
||||
dump((string)$this->body);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue