php cs fixes

This commit is contained in:
Julie Lenaerts 2024-05-22 15:26:23 +02:00
parent 2708bafb1f
commit 2895638f3b
8 changed files with 119 additions and 130 deletions

View File

@ -49,7 +49,6 @@ class ApiWrapper
return $data->access_token; return $data->access_token;
} }
try { try {
$response = $this->client->post('', [ $response = $this->client->post('', [
'query' => ['realm' => '/partenaire'], 'query' => ['realm' => '/partenaire'],

View File

@ -81,12 +81,10 @@ class PartenaireRomeAppellation
$this->client, $this->client,
$this->logger $this->logger
); );
} catch (ClientException $e) { } catch (ClientException $e) {
dump($e->getResponse()->getBody()->getContents()); dump($e->getResponse()->getBody()->getContents());
} }
return Utils::jsonDecode((string) $response->getBody()); return Utils::jsonDecode((string) $response->getBody());
} }

View File

@ -43,7 +43,7 @@ class Immersion implements \Stringable
* @Assert\NotNull() * @Assert\NotNull()
*/ */
#[ORM\ManyToOne(targetEntity: Person::class)] #[ORM\ManyToOne(targetEntity: Person::class)]
private ?\Chill\PersonBundle\Entity\Person $person = null; private ?Person $person = null;
/** /**
* @Assert\NotNull() * @Assert\NotNull()
@ -523,12 +523,11 @@ class Immersion implements \Stringable
/** /**
* Get duration. * Get duration.
*
*/ */
public function getDuration() public function getDuration()
{ {
return $this->duration; return $this->duration;
// return new \DateInterval($this->duration ?? 'P7D'); // return new \DateInterval($this->duration ?? 'P7D');
} }
public function getDateEndComputed() public function getDateEndComputed()

View File

@ -36,7 +36,7 @@ class ProjetProfessionnel implements \Stringable
* @Assert\NotNull() * @Assert\NotNull()
*/ */
#[ORM\ManyToOne(targetEntity: Person::class)] #[ORM\ManyToOne(targetEntity: Person::class)]
private ?\Chill\PersonBundle\Entity\Person $person = null; private ?Person $person = null;
/** /**
* @Assert\NotNull() * @Assert\NotNull()

View File

@ -24,13 +24,11 @@ use Symfony\Contracts\Translation\TranslatorInterface;
*/ */
class AddCSPersonToPersonListHelper implements CustomizeListPersonHelperInterface class AddCSPersonToPersonListHelper implements CustomizeListPersonHelperInterface
{ {
public function __construct(private readonly TranslatorInterface $translator) public function __construct(private readonly TranslatorInterface $translator) {}
{
}
private const CSPERSON_FIELDS = [ private const CSPERSON_FIELDS = [
'dateFinDernierEmploi', 'dateFinDernierEmploi',
/* 'prescripteur__name', /* 'prescripteur__name',
'prescripteur__email', 'prescripteur__email',
'prescripteur__phone',*/ 'prescripteur__phone',*/
'poleEmploiId', 'poleEmploiId',
@ -50,11 +48,11 @@ class AddCSPersonToPersonListHelper implements CustomizeListPersonHelperInterfac
public function alterKeys(array $existing): array public function alterKeys(array $existing): array
{ {
$ressources = array_map(static fn ($key) => 'ressources__' . $key, CSPerson::RESSOURCES); $ressources = array_map(static fn ($key) => 'ressources__'.$key, CSPerson::RESSOURCES);
$moyenTransport = array_map(static fn ($key) => 'moyen_transport__' . $key, CSPerson::MOBILITE_MOYEN_TRANSPORT); $moyenTransport = array_map(static fn ($key) => 'moyen_transport__'.$key, CSPerson::MOBILITE_MOYEN_TRANSPORT);
$accompagnements = array_map(static fn ($key) => 'accompagnements__' . $key, CSPerson::ACCOMPAGNEMENTS); $accompagnements = array_map(static fn ($key) => 'accompagnements__'.$key, CSPerson::ACCOMPAGNEMENTS);
$permisConduire = array_map(static fn ($key) => 'permis_conduire__' . $key, CSPerson::PERMIS_CONDUIRE); $permisConduire = array_map(static fn ($key) => 'permis_conduire__'.$key, CSPerson::PERMIS_CONDUIRE);
$typeContrat = array_map(static fn ($key) => 'type_contrat__' . $key, CSPerson::TYPE_CONTRAT); $typeContrat = array_map(static fn ($key) => 'type_contrat__'.$key, CSPerson::TYPE_CONTRAT);
return [ return [
...$existing, ...$existing,
@ -76,47 +74,41 @@ class AddCSPersonToPersonListHelper implements CustomizeListPersonHelperInterfac
$qb->addSelect(sprintf('cs_person.%s as %s', $f, $f)); $qb->addSelect(sprintf('cs_person.%s as %s', $f, $f));
} }
/* $qb->addSelect('cs_person.situationProfessionnelle as situation_prof'); /* $qb->addSelect('cs_person.situationProfessionnelle as situation_prof');
$qb->addSelect('cs_person.nEETEligibilite as nEETEligibilite');*/ $qb->addSelect('cs_person.nEETEligibilite as nEETEligibilite');*/
$i = 0; $i = 0;
foreach (CSPerson::RESSOURCES as $key) foreach (CSPerson::RESSOURCES as $key) {
{ $qb->addSelect("JSONB_EXISTS_IN_ARRAY(cs_person.ressources, :param_{$i}) AS ressources__".$key)
$qb->addSelect("JSONB_EXISTS_IN_ARRAY(cs_person.ressources, :param_$i) AS ressources__" . $key)
->setParameter('param_'.$i, $key); ->setParameter('param_'.$i, $key);
++$i; ++$i;
} }
foreach(CSPerson::MOBILITE_MOYEN_TRANSPORT as $key) foreach (CSPerson::MOBILITE_MOYEN_TRANSPORT as $key) {
{ $qb->addSelect("JSONB_EXISTS_IN_ARRAY(cs_person.mobiliteMoyenDeTransport, :param_{$i}) AS moyen_transport__".$key)
$qb->addSelect("JSONB_EXISTS_IN_ARRAY(cs_person.mobiliteMoyenDeTransport, :param_$i) AS moyen_transport__" . $key)
->setParameter('param_'.$i, $key); ->setParameter('param_'.$i, $key);
++$i; ++$i;
} }
foreach(CSPerson::TYPE_CONTRAT as $key) foreach (CSPerson::TYPE_CONTRAT as $key) {
{ $qb->addSelect("JSONB_EXISTS_IN_ARRAY(cs_person.typeContrat, :param_{$i}) AS type_contrat__".$key)
$qb->addSelect("JSONB_EXISTS_IN_ARRAY(cs_person.typeContrat, :param_$i) AS type_contrat__" . $key)
->setParameter('param_'.$i, $key); ->setParameter('param_'.$i, $key);
++$i; ++$i;
} }
foreach (CSPerson::ACCOMPAGNEMENTS as $key) foreach (CSPerson::ACCOMPAGNEMENTS as $key) {
{ $qb->addSelect("JSONB_EXISTS_IN_ARRAY(cs_person.accompagnement, :param_{$i}) AS accompagnements__".$key)
$qb->addSelect("JSONB_EXISTS_IN_ARRAY(cs_person.accompagnement, :param_$i) AS accompagnements__" . $key)
->setParameter('param_'.$i, $key); ->setParameter('param_'.$i, $key);
++$i; ++$i;
} }
foreach (CSPerson::PERMIS_CONDUIRE as $key) foreach (CSPerson::PERMIS_CONDUIRE as $key) {
{ $qb->addSelect("JSONB_EXISTS_IN_ARRAY(cs_person.permisConduire, :param_{$i}) AS permis_conduire__".$key)
$qb->addSelect("JSONB_EXISTS_IN_ARRAY(cs_person.permisConduire, :param_$i) AS permis_conduire__" . $key)
->setParameter('param_'.$i, $key); ->setParameter('param_'.$i, $key);
++$i; ++$i;
} }
} }
public function getLabels(string $key, array $values, array $data): ?callable public function getLabels(string $key, array $values, array $data): ?callable
@ -126,7 +118,8 @@ class AddCSPersonToPersonListHelper implements CustomizeListPersonHelperInterfac
return function (string|bool|null $value) use ($key): string { return function (string|bool|null $value) use ($key): string {
if ('_header' === $value) { if ('_header' === $value) {
[$domain, $v] = explode('__', $key); [$domain, $v] = explode('__', $key);
return 'export.list.cs_person.' . $domain . '.' . $v;
return 'export.list.cs_person.'.$domain.'.'.$v;
} }
if ('1' === $value || true === $value || 1 === $value || 't' === $value) { if ('1' === $value || true === $value || 1 === $value || 't' === $value) {
@ -136,7 +129,7 @@ class AddCSPersonToPersonListHelper implements CustomizeListPersonHelperInterfac
return ''; return '';
}; };
case 'nEETEligibilite': case 'nEETEligibilite':
return function (string|bool|null $value) use ($key): string { return function (string|bool|null $value): string {
if ('_header' === $value) { if ('_header' === $value) {
return 'export.list.cs_person.neet_eligibility'; return 'export.list.cs_person.neet_eligibility';
} }
@ -148,7 +141,7 @@ class AddCSPersonToPersonListHelper implements CustomizeListPersonHelperInterfac
return ''; return '';
}; };
case 'situationProfessionnelle': case 'situationProfessionnelle':
return function ($value) use ($key) { return function ($value) {
if ('_header' === $value) { if ('_header' === $value) {
return 'export.list.cs_person.situation_professionelle'; return 'export.list.cs_person.situation_professionelle';
} }

View File

@ -92,7 +92,7 @@ class ListCV implements ListInterface, ExportElementValidatedInterface
->add('fields', ChoiceType::class, [ ->add('fields', ChoiceType::class, [
'multiple' => true, 'multiple' => true,
'expanded' => true, 'expanded' => true,
// 'choices_as_values' => true, // 'choices_as_values' => true,
'label' => 'Fields to include in export', 'label' => 'Fields to include in export',
'choices' => array_combine($this->getFields(), $this->getFields()), 'choices' => array_combine($this->getFields(), $this->getFields()),
'data' => array_combine($this->getFields(), $this->getFields()), 'data' => array_combine($this->getFields(), $this->getFields()),

View File

@ -105,7 +105,7 @@ class ListFrein implements ListInterface, ExportElementValidatedInterface
->add('fields', ChoiceType::class, [ ->add('fields', ChoiceType::class, [
'multiple' => true, 'multiple' => true,
'expanded' => true, 'expanded' => true,
// 'choices_as_values' => true, // 'choices_as_values' => true,
'label' => 'Fields to include in export', 'label' => 'Fields to include in export',
'choices' => array_combine($this->getFields(), $this->getFields()), 'choices' => array_combine($this->getFields(), $this->getFields()),
'data' => array_combine($this->getFields(), $this->getFields()), 'data' => array_combine($this->getFields(), $this->getFields()),

View File

@ -110,7 +110,7 @@ class ListProjetProfessionnel implements ListInterface, ExportElementValidatedIn
->add('fields', ChoiceType::class, [ ->add('fields', ChoiceType::class, [
'multiple' => true, 'multiple' => true,
'expanded' => true, 'expanded' => true,
// 'choices_as_values' => true, // 'choices_as_values' => true,
'label' => 'Fields to include in export', 'label' => 'Fields to include in export',
'choice_label' => fn ($key) => str_replace('__', '.', (string) $key), 'choice_label' => fn ($key) => str_replace('__', '.', (string) $key),
'choices' => array_combine($this->getFields(), $this->getFields()), 'choices' => array_combine($this->getFields(), $this->getFields()),