Merge branch 'v4.0.4' into 'develop'

chore: ⬆️ bump to v4.0.4

See merge request ldc-web/projets/crm-client!6
This commit is contained in:
Vincent BRIDIER 2024-10-14 14:21:55 +00:00
commit d7c4018d01
5 changed files with 112 additions and 106 deletions

View file

@ -2,6 +2,9 @@
### All notable changes to `CRM CLient V4` will be documented in this file.
# version 4.0.4
- chore: :arrow_up: bump to v4.0.4
# version 4.0.3
- chore: :arrow_up: bump to v4.0.3

View file

@ -1,5 +1,5 @@
{
"version": "4.0.3",
"version": "4.0.4",
"timestampTimeout": 30,
"apiRequestRatePerMinute": 256,
"servicesDBCache": 10

View file

@ -3,7 +3,7 @@
"type": "library",
"description": "LDC CRM Client V4",
"license": "MIT",
"version": "4.0.3",
"version": "4.0.4",
"authors": [
{
"name": "Jérémy Munsch",
@ -20,6 +20,7 @@
],
"require": {
"php": "^8.2",
"doctrine/inflector": "^2.0",
"ext-curl": "*",
"guzzlehttp/guzzle": "^7.4",
"respect/validation": "^2.2"

186
composer.lock generated
View file

@ -4,8 +4,99 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "46d0f076c74afaa5b636e0b6283ad48e",
"content-hash": "eb380867bcf551762b352ecb8f201c22",
"packages": [
{
"name": "doctrine/inflector",
"version": "2.0.10",
"source": {
"type": "git",
"url": "https://github.com/doctrine/inflector.git",
"reference": "5817d0659c5b50c9b950feb9af7b9668e2c436bc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/inflector/zipball/5817d0659c5b50c9b950feb9af7b9668e2c436bc",
"reference": "5817d0659c5b50c9b950feb9af7b9668e2c436bc",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0"
},
"require-dev": {
"doctrine/coding-standard": "^11.0",
"phpstan/phpstan": "^1.8",
"phpstan/phpstan-phpunit": "^1.1",
"phpstan/phpstan-strict-rules": "^1.3",
"phpunit/phpunit": "^8.5 || ^9.5",
"vimeo/psalm": "^4.25 || ^5.4"
},
"type": "library",
"autoload": {
"psr-4": {
"Doctrine\\Inflector\\": "lib/Doctrine/Inflector"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
}
],
"description": "PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.",
"homepage": "https://www.doctrine-project.org/projects/inflector.html",
"keywords": [
"inflection",
"inflector",
"lowercase",
"manipulation",
"php",
"plural",
"singular",
"strings",
"uppercase",
"words"
],
"support": {
"issues": "https://github.com/doctrine/inflector/issues",
"source": "https://github.com/doctrine/inflector/tree/2.0.10"
},
"funding": [
{
"url": "https://www.doctrine-project.org/sponsorship.html",
"type": "custom"
},
{
"url": "https://www.patreon.com/phpdoctrine",
"type": "patreon"
},
{
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Finflector",
"type": "tidelift"
}
],
"time": "2024-02-18T20:23:39+00:00"
},
{
"name": "guzzlehttp/guzzle",
"version": "7.8.0",
@ -1097,97 +1188,6 @@
},
"time": "2022-10-27T11:44:00+00:00"
},
{
"name": "doctrine/inflector",
"version": "2.0.8",
"source": {
"type": "git",
"url": "https://github.com/doctrine/inflector.git",
"reference": "f9301a5b2fb1216b2b08f02ba04dc45423db6bff"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/inflector/zipball/f9301a5b2fb1216b2b08f02ba04dc45423db6bff",
"reference": "f9301a5b2fb1216b2b08f02ba04dc45423db6bff",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0"
},
"require-dev": {
"doctrine/coding-standard": "^11.0",
"phpstan/phpstan": "^1.8",
"phpstan/phpstan-phpunit": "^1.1",
"phpstan/phpstan-strict-rules": "^1.3",
"phpunit/phpunit": "^8.5 || ^9.5",
"vimeo/psalm": "^4.25 || ^5.4"
},
"type": "library",
"autoload": {
"psr-4": {
"Doctrine\\Inflector\\": "lib/Doctrine/Inflector"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
}
],
"description": "PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.",
"homepage": "https://www.doctrine-project.org/projects/inflector.html",
"keywords": [
"inflection",
"inflector",
"lowercase",
"manipulation",
"php",
"plural",
"singular",
"strings",
"uppercase",
"words"
],
"support": {
"issues": "https://github.com/doctrine/inflector/issues",
"source": "https://github.com/doctrine/inflector/tree/2.0.8"
},
"funding": [
{
"url": "https://www.doctrine-project.org/sponsorship.html",
"type": "custom"
},
{
"url": "https://www.patreon.com/phpdoctrine",
"type": "patreon"
},
{
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Finflector",
"type": "tidelift"
}
],
"time": "2023-06-16T13:40:37+00:00"
},
{
"name": "doctrine/instantiator",
"version": "2.0.0",
@ -8972,7 +8972,7 @@
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": "^8.1",
"php": "^8.2",
"ext-curl": "*"
},
"platform-dev": [],

View file

@ -2,7 +2,7 @@
namespace LDC\LDCCRM\Traits;
use Illuminate\Support\Str;
use Doctrine\Inflector\InflectorFactory;
trait BaseEnum
{
@ -53,8 +53,8 @@ trait BaseEnum
if (!\is_null($labels) and !isset($labels[$enum->name])) {
throw new \Error('Missing definition label ' . self::class . " for {$enum->name}");
}
$array = array_merge($array, [$enum->name => \trans(
!\is_null($labels) ? $labels[$enum->name] : Str::ucfirst($enum->name)
$array = array_merge($array, [$enum->name => __(
!\is_null($labels) ? $labels[$enum->name] : ucfirst($enum->name)
)]);
}, self::cases());
self::setCache('labels', $array);
@ -99,14 +99,15 @@ trait BaseEnum
if (empty(self::getCache('enums'))) {
$definitions = self::getCustomDefinitions();
$array = [];
\array_map(function ($enum) use (&$array, $definitions) {
$inflector = InflectorFactory::create()->build();
\array_map(function ($enum) use (&$array, $definitions, $inflector) {
$baseArray = [
'name' => $enum->name,
'label' => $enum->label(),
'value' => $enum->value,
];
foreach ($definitions as $index => $elements) {
$index = Str::lower(Str::singular($index));
$index = $inflector->singularize(strtolower($index));
if (!isset($elements[$enum->name])) {
throw new \Error("Missing definition {$index} " . self::class . " for {$enum->name}");
}
@ -115,7 +116,7 @@ trait BaseEnum
$array = array_merge($array, [$enum->name => (object)$baseArray]);
}, self::cases());
self::setCache('enums', $array);
}
} //end if
return self::getCache('enums');
}
@ -250,19 +251,20 @@ trait BaseEnum
$names = array_merge($names, [$enum->name => $enum]);
}, self::cases());
$GLOBALS[self::class]['customProps'] = \array_map(
function (mixed $enum) use ($names) {
if (!\is_array($enum)) {
$GLOBALS[self::class]['customProps'] = \array_filter(
(new \ReflectionClass(self::class))->getConstants(),
function (mixed $constant, string $key) use ($names) {
if ($key === 'LABELS' or !\is_array($constant)) {
return false;
}
return count(\array_filter(
$enum,
array_flip($constant),
function (string $name) use ($names) {
return array_key_exists($name, $names);
}
));
},
array_flip((new \ReflectionClass(self::class))->getConstants()),
ARRAY_FILTER_USE_BOTH
);
} //end if
return $GLOBALS[self::class]['customProps'];