mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
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.
This commit is contained in:
parent
8521672660
commit
b414b27ba9
@ -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';
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user