From b414b27ba907bc400da21a49a9b4825f7a92aada Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 25 Apr 2025 11:31:31 +0200 Subject: [PATCH] Make methods private in ExportDataNormalizerTrait Changed the visibility of several methods from public to private to improve encapsulation and restrict access to internal logic. This enhances code maintainability and prevents unintended use outside the intended scope. --- .../ChillMainBundle/Export/ExportDataNormalizerTrait.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Export/ExportDataNormalizerTrait.php b/src/Bundle/ChillMainBundle/Export/ExportDataNormalizerTrait.php index ee9ad2aa9..483e12cf8 100644 --- a/src/Bundle/ChillMainBundle/Export/ExportDataNormalizerTrait.php +++ b/src/Bundle/ChillMainBundle/Export/ExportDataNormalizerTrait.php @@ -30,7 +30,7 @@ trait ExportDataNormalizerTrait * an array of their identifiers is returned. If a single entity is provided, its identifier * is returned. If null, returns an empty value. */ - public function normalizeDoctrineEntity(object|array|null $entity): array|int|string + private function normalizeDoctrineEntity(object|array|null $entity): array|int|string { if (is_array($entity)) { return array_values(array_filter(array_map(static fn (object $entity) => $entity->getId(), $entity), fn ($value) => null !== $value)); @@ -52,7 +52,7 @@ trait ExportDataNormalizerTrait * * @throws \UnexpectedValueException when the entity with the given ID does not exist */ - public function denormalizeDoctrineEntity(array|int|string $id, ObjectRepository $repository): object|array + private function denormalizeDoctrineEntity(array|int|string $id, ObjectRepository $repository): object|array { if (is_array($id)) { return $repository->findBy(['id' => $id]); @@ -145,7 +145,7 @@ trait ExportDataNormalizerTrait * * @return string a formatted string containing the type and formatted date */ - public function normalizeDate(\DateTimeImmutable|\DateTime $date): string + private function normalizeDate(\DateTimeImmutable|\DateTime $date): string { return sprintf( '%s,%s', @@ -166,7 +166,7 @@ trait ExportDataNormalizerTrait * * @throws \UnexpectedValueException if the kind selector or date format is invalid */ - public function denormalizeDate(string $date): \DateTimeImmutable|\DateTime + private function denormalizeDate(string $date): \DateTimeImmutable|\DateTime { $format = 'd-m-Y-H:i:s.u e';