DX: apply rector rules up to php8.0

This commit is contained in:
2023-04-15 01:05:37 +02:00
parent d8870e906f
commit dde3002100
714 changed files with 2348 additions and 9263 deletions

View File

@@ -21,16 +21,8 @@ use function in_array;
class AdministrativeLocationAggregator implements AggregatorInterface
{
private LocationRepository $locationRepository;
private TranslatableStringHelper $translatableStringHelper;
public function __construct(
LocationRepository $locationRepository,
TranslatableStringHelper $translatableStringHelper
) {
$this->locationRepository = $locationRepository;
$this->translatableStringHelper = $translatableStringHelper;
public function __construct(private LocationRepository $locationRepository, private TranslatableStringHelper $translatableStringHelper)
{
}
public function addRole(): ?string

View File

@@ -20,16 +20,8 @@ use Symfony\Component\Form\FormBuilderInterface;
class ClosingMotiveAggregator implements AggregatorInterface
{
private ClosingMotiveRepositoryInterface $motiveRepository;
private TranslatableStringHelper $translatableStringHelper;
public function __construct(
ClosingMotiveRepositoryInterface $motiveRepository,
TranslatableStringHelper $translatableStringHelper
) {
$this->motiveRepository = $motiveRepository;
$this->translatableStringHelper = $translatableStringHelper;
public function __construct(private ClosingMotiveRepositoryInterface $motiveRepository, private TranslatableStringHelper $translatableStringHelper)
{
}
public function addRole(): ?string

View File

@@ -20,12 +20,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class ConfidentialAggregator implements AggregatorInterface
{
private TranslatorInterface $translator;
public function __construct(
TranslatorInterface $translator
) {
$this->translator = $translator;
public function __construct(private TranslatorInterface $translator)
{
}
public function addRole(): ?string
@@ -56,16 +52,11 @@ class ConfidentialAggregator implements AggregatorInterface
return 'Confidentiality';
}
switch ($value) {
case true:
return $this->translator->trans('is confidential');
case false:
return $this->translator->trans('is not confidential');
default:
throw new LogicException(sprintf('The value %s is not valid', $value));
}
return match ($value) {
true => $this->translator->trans('is confidential'),
false => $this->translator->trans('is not confidential'),
default => throw new LogicException(sprintf('The value %s is not valid', $value)),
};
};
}

View File

@@ -21,16 +21,8 @@ use function in_array;
class CreatorJobAggregator implements AggregatorInterface
{
private UserJobRepository $jobRepository;
private TranslatableStringHelper $translatableStringHelper;
public function __construct(
UserJobRepository $jobRepository,
TranslatableStringHelper $translatableStringHelper
) {
$this->jobRepository = $jobRepository;
$this->translatableStringHelper = $translatableStringHelper;
public function __construct(private UserJobRepository $jobRepository, private TranslatableStringHelper $translatableStringHelper)
{
}
public function addRole(): ?string

View File

@@ -28,11 +28,8 @@ final class DurationAggregator implements AggregatorInterface
'day',
];
private TranslatorInterface $translator;
public function __construct(TranslatorInterface $translator)
public function __construct(private TranslatorInterface $translator)
{
$this->translator = $translator;
}
public function addRole(): ?string
@@ -42,26 +39,13 @@ final class DurationAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data)
{
switch ($data['precision']) {
case 'day':
$qb->addSelect('(COALESCE(acp.closingDate, :now) - acp.openingDate) AS duration_aggregator');
break;
case 'week':
$qb->addSelect('(COALESCE(acp.closingDate, :now) - acp.openingDate) / 7 AS duration_aggregator');
break;
case 'month':
$qb->addSelect('(EXTRACT (MONTH FROM AGE(COALESCE(acp.closingDate, :now), acp.openingDate)) * 12 +
EXTRACT (MONTH FROM AGE(COALESCE(acp.closingDate, :now), acp.openingDate))) AS duration_aggregator');
break;
default:
throw new LogicException('precision not supported: ' . $data['precision']);
}
match ($data['precision']) {
'day' => $qb->addSelect('(COALESCE(acp.closingDate, :now) - acp.openingDate) AS duration_aggregator'),
'week' => $qb->addSelect('(COALESCE(acp.closingDate, :now) - acp.openingDate) / 7 AS duration_aggregator'),
'month' => $qb->addSelect('(EXTRACT (MONTH FROM AGE(COALESCE(acp.closingDate, :now), acp.openingDate)) * 12 +
EXTRACT (MONTH FROM AGE(COALESCE(acp.closingDate, :now), acp.openingDate))) AS duration_aggregator'),
default => throw new LogicException('precision not supported: ' . $data['precision']),
};
$qb
->setParameter('now', new DateTimeImmutable('now'))

View File

@@ -20,12 +20,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class EmergencyAggregator implements AggregatorInterface
{
private TranslatorInterface $translator;
public function __construct(
TranslatorInterface $translator
) {
$this->translator = $translator;
public function __construct(private TranslatorInterface $translator)
{
}
public function addRole(): ?string
@@ -56,16 +52,11 @@ class EmergencyAggregator implements AggregatorInterface
return 'Emergency';
}
switch ($value) {
case true:
return $this->translator->trans('is emergency');
case false:
return $this->translator->trans('is not emergency');
default:
throw new LogicException(sprintf('The value %s is not valid', $value));
}
return match ($value) {
true => $this->translator->trans('is emergency'),
false => $this->translator->trans('is not emergency'),
default => throw new LogicException(sprintf('The value %s is not valid', $value)),
};
};
}

View File

@@ -21,16 +21,8 @@ use function in_array;
final class EvaluationAggregator implements AggregatorInterface
{
private EvaluationRepository $evaluationRepository;
private TranslatableStringHelper $translatableStringHelper;
public function __construct(
EvaluationRepository $evaluationRepository,
TranslatableStringHelper $translatableStringHelper
) {
$this->evaluationRepository = $evaluationRepository;
$this->translatableStringHelper = $translatableStringHelper;
public function __construct(private EvaluationRepository $evaluationRepository, private TranslatableStringHelper $translatableStringHelper)
{
}
public function addRole(): ?string

View File

@@ -29,20 +29,8 @@ use UnexpectedValueException;
final class GeographicalUnitStatAggregator implements AggregatorInterface
{
private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository;
private RollingDateConverterInterface $rollingDateConverter;
private TranslatableStringHelperInterface $translatableStringHelper;
public function __construct(
GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository,
TranslatableStringHelperInterface $translatableStringHelper,
RollingDateConverterInterface $rollingDateConverter
) {
$this->geographicalUnitLayerRepository = $geographicalUnitLayerRepository;
$this->translatableStringHelper = $translatableStringHelper;
$this->rollingDateConverter = $rollingDateConverter;
public function __construct(private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private TranslatableStringHelperInterface $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter)
{
}
public function addRole(): ?string
@@ -134,36 +122,31 @@ final class GeographicalUnitStatAggregator implements AggregatorInterface
public function getLabels($key, array $values, $data)
{
switch ($key) {
case 'acp_geog_agg_unitname':
return static function ($value): string {
if ('_header' === $value) {
return 'acp_geog_agg_unitname';
}
return match ($key) {
'acp_geog_agg_unitname' => static function ($value): string {
if ('_header' === $value) {
return 'acp_geog_agg_unitname';
}
if (null === $value || '' === $value) {
return '';
}
if (null === $value || '' === $value) {
return '';
}
return $value;
};
return $value;
},
'acp_geog_agg_unitrefid' => static function ($value): string {
if ('_header' === $value) {
return 'acp_geog_agg_unitrefid';
}
case 'acp_geog_agg_unitrefid':
return static function ($value): string {
if ('_header' === $value) {
return 'acp_geog_agg_unitrefid';
}
if (null === $value) {
return '';
}
if (null === $value) {
return '';
}
return $value;
};
default:
throw new UnexpectedValueException('this value should not happens');
}
return $value;
},
default => throw new UnexpectedValueException('this value should not happens'),
};
}
public function getQueryKeys($data): array

View File

@@ -20,12 +20,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class IntensityAggregator implements AggregatorInterface
{
private TranslatorInterface $translator;
public function __construct(
TranslatorInterface $translator
) {
$this->translator = $translator;
public function __construct(private TranslatorInterface $translator)
{
}
public function addRole(): ?string
@@ -56,16 +52,11 @@ class IntensityAggregator implements AggregatorInterface
return 'Intensity';
}
switch ($value) {
case 'occasional':
return $this->translator->trans('is occasional');
case 'regular':
return $this->translator->trans('is regular');
default:
throw new LogicException(sprintf('The value %s is not valid', $value));
}
return match ($value) {
'occasional' => $this->translator->trans('is occasional'),
'regular' => $this->translator->trans('is regular'),
default => throw new LogicException(sprintf('The value %s is not valid', $value)),
};
};
}

View File

@@ -25,14 +25,11 @@ final class OriginAggregator implements AggregatorInterface
{
private EntityRepository $repository;
private TranslatableStringHelper $translatableStringHelper;
public function __construct(
EntityManagerInterface $em,
TranslatableStringHelper $translatableStringHelper
private TranslatableStringHelper $translatableStringHelper
) {
$this->repository = $em->getRepository(Origin::class);
$this->translatableStringHelper = $translatableStringHelper;
}
public function addRole(): ?string

View File

@@ -27,20 +27,8 @@ final class ReferrerAggregator implements AggregatorInterface
private const P = 'acp_ref_agg_date';
private RollingDateConverterInterface $rollingDateConverter;
private UserRender $userRender;
private UserRepository $userRepository;
public function __construct(
UserRepository $userRepository,
UserRender $userRender,
RollingDateConverterInterface $rollingDateConverter
) {
$this->userRepository = $userRepository;
$this->userRender = $userRender;
$this->rollingDateConverter = $rollingDateConverter;
public function __construct(private UserRepository $userRepository, private UserRender $userRender, private RollingDateConverterInterface $rollingDateConverter)
{
}
public function addRole(): ?string

View File

@@ -26,20 +26,8 @@ class ReferrerScopeAggregator implements AggregatorInterface
{
private const SCOPE_KEY = 'acp_agg_refscope_user_history_ref_scope_name';
private RollingDateConverterInterface $rollingDateConverter;
private ScopeRepositoryInterface $scopeRepository;
private TranslatableStringHelperInterface $translatableStringHelper;
public function __construct(
ScopeRepositoryInterface $scopeRepository,
TranslatableStringHelperInterface $translatableStringHelper,
RollingDateConverterInterface $rollingDateConverter
) {
$this->scopeRepository = $scopeRepository;
$this->translatableStringHelper = $translatableStringHelper;
$this->rollingDateConverter = $rollingDateConverter;
public function __construct(private ScopeRepositoryInterface $scopeRepository, private TranslatableStringHelperInterface $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter)
{
}
public function addRole(): ?string

View File

@@ -20,12 +20,8 @@ use function in_array;
final class RequestorAggregator implements AggregatorInterface
{
private TranslatorInterface $translator;
public function __construct(
TranslatorInterface $translator
) {
$this->translator = $translator;
public function __construct(private TranslatorInterface $translator)
{
}
public function addRole(): ?string

View File

@@ -21,16 +21,8 @@ use function in_array;
final class ScopeAggregator implements AggregatorInterface
{
private ScopeRepository $scopeRepository;
private TranslatableStringHelper $translatableStringHelper;
public function __construct(
ScopeRepository $scopeRepository,
TranslatableStringHelper $translatableStringHelper
) {
$this->scopeRepository = $scopeRepository;
$this->translatableStringHelper = $translatableStringHelper;
public function __construct(private ScopeRepository $scopeRepository, private TranslatableStringHelper $translatableStringHelper)
{
}
public function addRole(): ?string

View File

@@ -21,16 +21,8 @@ use function in_array;
final class SocialActionAggregator implements AggregatorInterface
{
private SocialActionRender $actionRender;
private SocialActionRepository $actionRepository;
public function __construct(
SocialActionRender $actionRender,
SocialActionRepository $actionRepository
) {
$this->actionRender = $actionRender;
$this->actionRepository = $actionRepository;
public function __construct(private SocialActionRender $actionRender, private SocialActionRepository $actionRepository)
{
}
public function addRole(): ?string

View File

@@ -21,16 +21,8 @@ use function in_array;
final class SocialIssueAggregator implements AggregatorInterface
{
private SocialIssueRender $issueRender;
private SocialIssueRepository $issueRepository;
public function __construct(
SocialIssueRepository $issueRepository,
SocialIssueRender $issueRender
) {
$this->issueRepository = $issueRepository;
$this->issueRender = $issueRender;
public function __construct(private SocialIssueRepository $issueRepository, private SocialIssueRender $issueRender)
{
}
public function addRole(): ?string

View File

@@ -28,16 +28,8 @@ final class StepAggregator implements AggregatorInterface
private const P = 'acp_step_agg_date';
private RollingDateConverterInterface $rollingDateConverter;
private TranslatorInterface $translator;
public function __construct(
RollingDateConverterInterface $rollingDateConverter,
TranslatorInterface $translator
) {
$this->rollingDateConverter = $rollingDateConverter;
$this->translator = $translator;
public function __construct(private RollingDateConverterInterface $rollingDateConverter, private TranslatorInterface $translator)
{
}
public function addRole(): ?string

View File

@@ -21,16 +21,8 @@ use function in_array;
final class UserJobAggregator implements AggregatorInterface
{
private UserJobRepository $jobRepository;
private TranslatableStringHelper $translatableStringHelper;
public function __construct(
UserJobRepository $jobRepository,
TranslatableStringHelper $translatableStringHelper
) {
$this->jobRepository = $jobRepository;
$this->translatableStringHelper = $translatableStringHelper;
public function __construct(private UserJobRepository $jobRepository, private TranslatableStringHelper $translatableStringHelper)
{
}
public function addRole(): ?string

View File

@@ -38,25 +38,12 @@ class ByEndDateAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data)
{
switch ($data['frequency']) {
case 'week':
$fmt = 'YYYY-IW';
break;
case 'month':
$fmt = 'YYYY-MM';
break;
case 'year':
$fmt = 'YYYY';
break;
default:
throw new LogicException(sprintf("The frequency data '%s' is invalid.", $data['frequency']));
}
$fmt = match ($data['frequency']) {
'week' => 'YYYY-IW',
'month' => 'YYYY-MM',
'year' => 'YYYY',
default => throw new LogicException(sprintf("The frequency data '%s' is invalid.", $data['frequency'])),
};
$qb->addSelect(sprintf("TO_CHAR(workeval.endDate, '%s') AS eval_by_end_date_aggregator", $fmt));
$qb->addGroupBy(' eval_by_end_date_aggregator');

View File

@@ -38,25 +38,12 @@ class ByMaxDateAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data)
{
switch ($data['frequency']) {
case 'week':
$fmt = 'YYYY-IW';
break;
case 'month':
$fmt = 'YYYY-MM';
break;
case 'year':
$fmt = 'YYYY';
break;
default:
throw new LogicException(sprintf("The frequency data '%s' is invalid.", $data['frequency']));
}
$fmt = match ($data['frequency']) {
'week' => 'YYYY-IW',
'month' => 'YYYY-MM',
'year' => 'YYYY',
default => throw new LogicException(sprintf("The frequency data '%s' is invalid.", $data['frequency'])),
};
$qb->addSelect(sprintf("TO_CHAR(workeval.maxDate, '%s') AS eval_by_max_date_aggregator", $fmt));
$qb->addGroupBy(' eval_by_max_date_aggregator');

View File

@@ -38,25 +38,12 @@ class ByStartDateAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data)
{
switch ($data['frequency']) {
case 'week':
$fmt = 'YYYY-IW';
break;
case 'month':
$fmt = 'YYYY-MM';
break;
case 'year':
$fmt = 'YYYY';
break;
default:
throw new LogicException(sprintf("The frequency data '%s' is invalid.", $data['frequency']));
}
$fmt = match ($data['frequency']) {
'week' => 'YYYY-IW',
'month' => 'YYYY-MM',
'year' => 'YYYY',
default => throw new LogicException(sprintf("The frequency data '%s' is invalid.", $data['frequency'])),
};
$qb->addSelect(sprintf("TO_CHAR(workeval.startDate, '%s') AS eval_by_start_date_aggregator", $fmt));
$qb->addGroupBy(' eval_by_start_date_aggregator');

View File

@@ -20,16 +20,8 @@ use Symfony\Component\Form\FormBuilderInterface;
class EvaluationTypeAggregator implements AggregatorInterface
{
private EvaluationRepository $evaluationRepository;
private TranslatableStringHelper $translatableStringHelper;
public function __construct(
EvaluationRepository $evaluationRepository,
TranslatableStringHelper $translatableStringHelper
) {
$this->evaluationRepository = $evaluationRepository;
$this->translatableStringHelper = $translatableStringHelper;
public function __construct(private EvaluationRepository $evaluationRepository, private TranslatableStringHelper $translatableStringHelper)
{
}
public function addRole(): ?string

View File

@@ -20,11 +20,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class HavingEndDateAggregator implements AggregatorInterface
{
private TranslatorInterface $translator;
public function __construct(TranslatorInterface $translator)
public function __construct(private TranslatorInterface $translator)
{
$this->translator = $translator;
}
public function addRole(): ?string
@@ -56,16 +53,11 @@ class HavingEndDateAggregator implements AggregatorInterface
return 'export.aggregator.eval.by_end_date.Has end date ?';
}
switch ($value) {
case true:
return $this->translator->trans('export.aggregator.eval.by_end_date.enddate is specified');
case false:
return $this->translator->trans('export.aggregator.eval.by_end_date.enddate is not specified');
default:
throw new LogicException(sprintf('The value %s is not valid', $value));
}
return match ($value) {
true => $this->translator->trans('export.aggregator.eval.by_end_date.enddate is specified'),
false => $this->translator->trans('export.aggregator.eval.by_end_date.enddate is not specified'),
default => throw new LogicException(sprintf('The value %s is not valid', $value)),
};
};
}

View File

@@ -24,16 +24,8 @@ use function in_array;
class ChildrenNumberAggregator implements AggregatorInterface
{
private RollingDateConverterInterface $rollingDateConverter;
private TranslatorInterface $translator;
public function __construct(
TranslatorInterface $translator,
RollingDateConverterInterface $rollingDateConverter
) {
$this->translator = $translator;
$this->rollingDateConverter = $rollingDateConverter;
public function __construct(private TranslatorInterface $translator, private RollingDateConverterInterface $rollingDateConverter)
{
}
public function addRole(): ?string

View File

@@ -25,20 +25,8 @@ use function in_array;
class CompositionAggregator implements AggregatorInterface
{
private RollingDateConverterInterface $rollingDateConverter;
private TranslatableStringHelper $translatableStringHelper;
private HouseholdCompositionTypeRepository $typeRepository;
public function __construct(
HouseholdCompositionTypeRepository $typeRepository,
TranslatableStringHelper $translatableStringHelper,
RollingDateConverterInterface $rollingDateConverter
) {
$this->typeRepository = $typeRepository;
$this->translatableStringHelper = $translatableStringHelper;
$this->rollingDateConverter = $rollingDateConverter;
public function __construct(private HouseholdCompositionTypeRepository $typeRepository, private TranslatableStringHelper $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter)
{
}
public function addRole(): ?string

View File

@@ -22,11 +22,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
final class AgeAggregator implements AggregatorInterface, ExportElementValidatedInterface
{
private TranslatorInterface $translator;
public function __construct(TranslatorInterface $translator)
public function __construct(private TranslatorInterface $translator)
{
$this->translator = $translator;
}
public function addRole(): ?string

View File

@@ -27,20 +27,8 @@ class ByHouseholdCompositionAggregator implements AggregatorInterface
{
private const PREFIX = 'acp_by_household_compo_agg';
private HouseholdCompositionTypeRepositoryInterface $householdCompositionTypeRepository;
private RollingDateConverterInterface $rollingDateConverter;
private TranslatableStringHelperInterface $translatableStringHelper;
public function __construct(
RollingDateConverterInterface $rollingDateConverter,
HouseholdCompositionTypeRepositoryInterface $householdCompositionTypeRepository,
TranslatableStringHelperInterface $translatableStringHelper
) {
$this->householdCompositionTypeRepository = $householdCompositionTypeRepository;
$this->translatableStringHelper = $translatableStringHelper;
$this->rollingDateConverter = $rollingDateConverter;
public function __construct(private RollingDateConverterInterface $rollingDateConverter, private HouseholdCompositionTypeRepositoryInterface $householdCompositionTypeRepository, private TranslatableStringHelperInterface $translatableStringHelper)
{
}
public function addRole(): ?string

View File

@@ -27,20 +27,8 @@ use function in_array;
final class CountryOfBirthAggregator implements AggregatorInterface, ExportElementValidatedInterface
{
private CountryRepository $countriesRepository;
private TranslatableStringHelper $translatableStringHelper;
private TranslatorInterface $translator;
public function __construct(
CountryRepository $countriesRepository,
TranslatableStringHelper $translatableStringHelper,
TranslatorInterface $translator
) {
$this->countriesRepository = $countriesRepository;
$this->translatableStringHelper = $translatableStringHelper;
$this->translator = $translator;
public function __construct(private CountryRepository $countriesRepository, private TranslatableStringHelper $translatableStringHelper, private TranslatorInterface $translator)
{
}
public function addRole(): ?string

View File

@@ -21,11 +21,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
final class GenderAggregator implements AggregatorInterface
{
private TranslatorInterface $translator;
public function __construct(TranslatorInterface $translator)
public function __construct(private TranslatorInterface $translator)
{
$this->translator = $translator;
}
public function addRole(): ?string

View File

@@ -26,20 +26,8 @@ use Symfony\Component\Form\FormBuilderInterface;
class GeographicalUnitAggregator implements AggregatorInterface
{
private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository;
private RollingDateConverterInterface $rollingDateConverter;
private TranslatableStringHelperInterface $translatableStringHelper;
public function __construct(
GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository,
TranslatableStringHelperInterface $translatableStringHelper,
RollingDateConverterInterface $rollingDateConverter
) {
$this->geographicalUnitLayerRepository = $geographicalUnitLayerRepository;
$this->translatableStringHelper = $translatableStringHelper;
$this->rollingDateConverter = $rollingDateConverter;
public function __construct(private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private TranslatableStringHelperInterface $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter)
{
}
public function addRole(): ?string
@@ -111,36 +99,31 @@ class GeographicalUnitAggregator implements AggregatorInterface
public function getLabels($key, array $values, $data)
{
switch ($key) {
case 'geog_unit_name':
return static function ($value): string {
if ('_header' === $value) {
return 'acp_geog_agg_unitname';
}
return match ($key) {
'geog_unit_name' => static function ($value): string {
if ('_header' === $value) {
return 'acp_geog_agg_unitname';
}
if (null === $value) {
return '';
}
if (null === $value) {
return '';
}
return $value;
};
return $value;
},
'geog_unit_key' => static function ($value): string {
if ('_header' === $value) {
return 'acp_geog_agg_unitrefid';
}
case 'geog_unit_key':
return static function ($value): string {
if ('_header' === $value) {
return 'acp_geog_agg_unitrefid';
}
if (null === $value) {
return '';
}
if (null === $value) {
return '';
}
return $value;
};
default:
throw new LogicException('key not supported');
}
return $value;
},
default => throw new LogicException('key not supported'),
};
}
public function getQueryKeys($data)

View File

@@ -29,24 +29,8 @@ use function in_array;
final class HouseholdPositionAggregator implements AggregatorInterface, ExportElementValidatedInterface
{
private PositionRepository $positionRepository;
private RollingDateConverterInterface $rollingDateConverter;
private TranslatableStringHelper $translatableStringHelper;
private TranslatorInterface $translator;
public function __construct(
TranslatorInterface $translator,
TranslatableStringHelper $translatableStringHelper,
PositionRepository $positionRepository,
RollingDateConverterInterface $rollingDateConverter
) {
$this->translator = $translator;
$this->positionRepository = $positionRepository;
$this->translatableStringHelper = $translatableStringHelper;
$this->rollingDateConverter = $rollingDateConverter;
public function __construct(private TranslatorInterface $translator, private TranslatableStringHelper $translatableStringHelper, private PositionRepository $positionRepository, private RollingDateConverterInterface $rollingDateConverter)
{
}
public function addRole(): ?string

View File

@@ -21,14 +21,8 @@ use function in_array;
final class MaritalStatusAggregator implements AggregatorInterface
{
private MaritalStatusRepository $maritalStatusRepository;
private TranslatableStringHelper $translatableStringHelper;
public function __construct(MaritalStatusRepository $maritalStatusRepository, TranslatableStringHelper $translatableStringHelper)
public function __construct(private MaritalStatusRepository $maritalStatusRepository, private TranslatableStringHelper $translatableStringHelper)
{
$this->maritalStatusRepository = $maritalStatusRepository;
$this->translatableStringHelper = $translatableStringHelper;
}
public function addRole(): ?string

View File

@@ -25,20 +25,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
final class NationalityAggregator implements AggregatorInterface, ExportElementValidatedInterface
{
private CountryRepository $countriesRepository;
private TranslatableStringHelper $translatableStringHelper;
private TranslatorInterface $translator;
public function __construct(
CountryRepository $countriesRepository,
TranslatableStringHelper $translatableStringHelper,
TranslatorInterface $translator
) {
$this->countriesRepository = $countriesRepository;
$this->translatableStringHelper = $translatableStringHelper;
$this->translator = $translator;
public function __construct(private CountryRepository $countriesRepository, private TranslatableStringHelper $translatableStringHelper, private TranslatorInterface $translator)
{
}
public function addRole(): ?string

View File

@@ -24,24 +24,8 @@ use function in_array;
final class ActionTypeAggregator implements AggregatorInterface
{
private SocialActionRender $actionRender;
private SocialActionRepository $socialActionRepository;
private SocialIssueRender $socialIssueRender;
private SocialIssueRepository $socialIssueRepository;
public function __construct(
SocialActionRepository $socialActionRepository,
SocialActionRender $actionRender,
SocialIssueRender $socialIssueRender,
SocialIssueRepository $socialIssueRepository
) {
$this->socialActionRepository = $socialActionRepository;
$this->actionRender = $actionRender;
$this->socialIssueRender = $socialIssueRender;
$this->socialIssueRepository = $socialIssueRepository;
public function __construct(private SocialActionRepository $socialActionRepository, private SocialActionRender $actionRender, private SocialIssueRender $socialIssueRender, private SocialIssueRepository $socialIssueRepository)
{
}
public function addRole(): ?string
@@ -78,36 +62,31 @@ final class ActionTypeAggregator implements AggregatorInterface
public function getLabels($key, array $values, $data)
{
switch ($key) {
case 'action_type_aggregator':
return function ($value): string {
if ('_header' === $value) {
return 'Social Action Type';
}
return match ($key) {
'action_type_aggregator' => function ($value): string {
if ('_header' === $value) {
return 'Social Action Type';
}
if (null === $value || '' === $value || null === $sa = $this->socialActionRepository->find($value)) {
return '';
}
if (null === $value || '' === $value || null === $sa = $this->socialActionRepository->find($value)) {
return '';
}
return $this->actionRender->renderString($sa, []);
};
return $this->actionRender->renderString($sa, []);
},
'social_action_type_aggregator' => function ($value): string {
if ('_header' === $value) {
return 'Social Issue';
}
case 'social_action_type_aggregator':
return function ($value): string {
if ('_header' === $value) {
return 'Social Issue';
}
if (null === $value || null === $si = $this->socialIssueRepository->find($value)) {
return '';
}
if (null === $value || null === $si = $this->socialIssueRepository->find($value)) {
return '';
}
return $this->socialIssueRender->renderString($si, []);
};
default:
throw new LogicException('this key is not supported: ' . $key);
}
return $this->socialIssueRender->renderString($si, []);
},
default => throw new LogicException('this key is not supported: ' . $key),
};
}
public function getQueryKeys($data)

View File

@@ -20,11 +20,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class CurrentActionAggregator implements AggregatorInterface
{
private TranslatorInterface $translator;
public function __construct(TranslatorInterface $translator)
public function __construct(private TranslatorInterface $translator)
{
$this->translator = $translator;
}
public function addRole(): ?string
@@ -59,16 +56,11 @@ class CurrentActionAggregator implements AggregatorInterface
return 'export.aggregator.course_work.by_current_action.Current action ?';
}
switch ($value) {
case true:
return $this->translator->trans('export.aggregator.course_work.by_current_action.Current action');
case false:
return $this->translator->trans('export.aggregator.course_work.by_current_action.Not current action');
default:
throw new LogicException(sprintf('The value %s is not valid', $value));
}
return match ($value) {
true => $this->translator->trans('export.aggregator.course_work.by_current_action.Current action'),
false => $this->translator->trans('export.aggregator.course_work.by_current_action.Not current action'),
default => throw new LogicException(sprintf('The value %s is not valid', $value)),
};
};
}

View File

@@ -21,14 +21,8 @@ use function in_array;
final class GoalAggregator implements AggregatorInterface
{
private GoalRepository $goalRepository;
private TranslatableStringHelper $translatableStringHelper;
public function __construct(GoalRepository $goalRepository, TranslatableStringHelper $translatableStringHelper)
public function __construct(private GoalRepository $goalRepository, private TranslatableStringHelper $translatableStringHelper)
{
$this->goalRepository = $goalRepository;
$this->translatableStringHelper = $translatableStringHelper;
}
public function addRole(): ?string

View File

@@ -23,20 +23,8 @@ use function in_array;
class GoalResultAggregator implements AggregatorInterface
{
private GoalRepository $goalRepository;
private ResultRepository $resultRepository;
private TranslatableStringHelper $translatableStringHelper;
public function __construct(
ResultRepository $resultRepository,
GoalRepository $goalRepository,
TranslatableStringHelper $translatableStringHelper
) {
$this->resultRepository = $resultRepository;
$this->goalRepository = $goalRepository;
$this->translatableStringHelper = $translatableStringHelper;
public function __construct(private ResultRepository $resultRepository, private GoalRepository $goalRepository, private TranslatableStringHelper $translatableStringHelper)
{
}
public function addRole(): ?string

View File

@@ -21,16 +21,8 @@ use function in_array;
final class JobAggregator implements AggregatorInterface
{
private UserJobRepository $jobRepository;
private TranslatableStringHelper $translatableStringHelper;
public function __construct(
UserJobRepository $jobRepository,
TranslatableStringHelper $translatableStringHelper
) {
$this->jobRepository = $jobRepository;
$this->translatableStringHelper = $translatableStringHelper;
public function __construct(private UserJobRepository $jobRepository, private TranslatableStringHelper $translatableStringHelper)
{
}
public function addRole(): ?string

View File

@@ -21,16 +21,8 @@ use function in_array;
final class ReferrerAggregator implements AggregatorInterface
{
private UserRender $userRender;
private UserRepository $userRepository;
public function __construct(
UserRepository $userRepository,
UserRender $userRender
) {
$this->userRepository = $userRepository;
$this->userRender = $userRender;
public function __construct(private UserRepository $userRepository, private UserRender $userRender)
{
}
public function addRole(): ?string

View File

@@ -21,14 +21,8 @@ use function in_array;
final class ResultAggregator implements AggregatorInterface
{
private ResultRepository $resultRepository;
private TranslatableStringHelper $translatableStringHelper;
public function __construct(ResultRepository $resultRepository, TranslatableStringHelper $translatableStringHelper)
public function __construct(private ResultRepository $resultRepository, private TranslatableStringHelper $translatableStringHelper)
{
$this->resultRepository = $resultRepository;
$this->translatableStringHelper = $translatableStringHelper;
}
public function addRole(): ?string

View File

@@ -21,16 +21,8 @@ use function in_array;
final class ScopeAggregator implements AggregatorInterface
{
private ScopeRepository $scopeRepository;
private TranslatableStringHelper $translatableStringHelper;
public function __construct(
ScopeRepository $scopeRepository,
TranslatableStringHelper $translatableStringHelper
) {
$this->scopeRepository = $scopeRepository;
$this->translatableStringHelper = $translatableStringHelper;
public function __construct(private ScopeRepository $scopeRepository, private TranslatableStringHelper $translatableStringHelper)
{
}
public function addRole(): ?string

View File

@@ -26,12 +26,8 @@ use Symfony\Component\Form\FormBuilderInterface;
class CountAccompanyingPeriodWork implements ExportInterface, GroupedExportInterface
{
protected EntityManagerInterface $em;
public function __construct(
EntityManagerInterface $em
) {
$this->em = $em;
public function __construct(protected EntityManagerInterface $em)
{
}
public function buildForm(FormBuilderInterface $builder): void

View File

@@ -25,12 +25,8 @@ use Symfony\Component\Form\FormBuilderInterface;
class CountEvaluation implements ExportInterface, GroupedExportInterface
{
private EntityManagerInterface $entityManager;
public function __construct(
EntityManagerInterface $em
) {
$this->entityManager = $em;
public function __construct(private EntityManagerInterface $entityManager)
{
}
public function buildForm(FormBuilderInterface $builder)

View File

@@ -30,16 +30,8 @@ class CountHousehold implements ExportInterface, GroupedExportInterface
{
private const TR_PREFIX = 'export.export.nb_household_with_course.';
private EntityManagerInterface $entityManager;
private RollingDateConverterInterface $rollingDateConverter;
public function __construct(
EntityManagerInterface $em,
RollingDateConverterInterface $rollingDateConverter
) {
$this->entityManager = $em;
$this->rollingDateConverter = $rollingDateConverter;
public function __construct(private EntityManagerInterface $entityManager, private RollingDateConverterInterface $rollingDateConverter)
{
}
public function buildForm(FormBuilderInterface $builder)
@@ -71,16 +63,11 @@ class CountHousehold implements ExportInterface, GroupedExportInterface
{
return static function ($value) use ($key) {
if ('_header' === $value) {
switch ($key) {
case 'household_export_result':
return self::TR_PREFIX . 'Count households';
case 'acp_export_result':
return self::TR_PREFIX . 'Count accompanying periods';
default:
throw new LogicException('Key not supported: ' . $key);
}
return match ($key) {
'household_export_result' => self::TR_PREFIX . 'Count households',
'acp_export_result' => self::TR_PREFIX . 'Count accompanying periods',
default => throw new LogicException('Key not supported: ' . $key),
};
}
if (null === $value) {

View File

@@ -25,12 +25,8 @@ use Symfony\Component\Form\FormBuilderInterface;
class CountPerson implements ExportInterface, GroupedExportInterface
{
protected PersonRepository $personRepository;
public function __construct(
PersonRepository $personRepository
) {
$this->personRepository = $personRepository;
public function __construct(protected PersonRepository $personRepository)
{
}
public function buildForm(FormBuilderInterface $builder)

View File

@@ -78,56 +78,8 @@ class ListAccompanyingPeriod implements ListInterface, GroupedExportInterface
'updatedBy',
];
private ExportAddressHelper $addressHelper;
private DateTimeHelper $dateTimeHelper;
private EntityManagerInterface $entityManager;
private PersonRenderInterface $personRender;
private PersonRepository $personRepository;
private RollingDateConverterInterface $rollingDateConverter;
private SocialIssueRender $socialIssueRender;
private SocialIssueRepository $socialIssueRepository;
private ThirdPartyRender $thirdPartyRender;
private ThirdPartyRepository $thirdPartyRepository;
private TranslatableStringHelperInterface $translatableStringHelper;
private UserHelper $userHelper;
public function __construct(
ExportAddressHelper $addressHelper,
DateTimeHelper $dateTimeHelper,
EntityManagerInterface $entityManager,
PersonRenderInterface $personRender,
PersonRepository $personRepository,
ThirdPartyRepository $thirdPartyRepository,
ThirdPartyRender $thirdPartyRender,
SocialIssueRepository $socialIssueRepository,
SocialIssueRender $socialIssueRender,
TranslatableStringHelperInterface $translatableStringHelper,
RollingDateConverterInterface $rollingDateConverter,
UserHelper $userHelper
) {
$this->addressHelper = $addressHelper;
$this->dateTimeHelper = $dateTimeHelper;
$this->entityManager = $entityManager;
$this->personRender = $personRender;
$this->personRepository = $personRepository;
$this->socialIssueRender = $socialIssueRender;
$this->socialIssueRepository = $socialIssueRepository;
$this->thirdPartyRender = $thirdPartyRender;
$this->thirdPartyRepository = $thirdPartyRepository;
$this->translatableStringHelper = $translatableStringHelper;
$this->rollingDateConverter = $rollingDateConverter;
$this->userHelper = $userHelper;
public function __construct(private ExportAddressHelper $addressHelper, private DateTimeHelper $dateTimeHelper, private EntityManagerInterface $entityManager, private PersonRenderInterface $personRender, private PersonRepository $personRepository, private ThirdPartyRepository $thirdPartyRepository, private ThirdPartyRender $thirdPartyRender, private SocialIssueRepository $socialIssueRepository, private SocialIssueRender $socialIssueRender, private TranslatableStringHelperInterface $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter, private UserHelper $userHelper)
{
}
public function buildForm(FormBuilderInterface $builder)
@@ -157,112 +109,91 @@ class ListAccompanyingPeriod implements ListInterface, GroupedExportInterface
public function getLabels($key, array $values, $data)
{
if (substr($key, 0, strlen('address_fields')) === 'address_fields') {
if (str_starts_with($key, 'address_fields')) {
return $this->addressHelper->getLabel($key, $values, $data, 'address_fields');
}
switch ($key) {
case 'stepSince':
case 'openingDate':
case 'closingDate':
case 'referrerSince':
case 'createdAt':
case 'updatedAt':
return $this->dateTimeHelper->getLabel('export.list.acp.' . $key);
return match ($key) {
'stepSince', 'openingDate', 'closingDate', 'referrerSince', 'createdAt', 'updatedAt' => $this->dateTimeHelper->getLabel('export.list.acp.' . $key),
'origin', 'closingMotive', 'job' => function ($value) use ($key) {
if ('_header' === $value) {
return 'export.list.acp.' . $key;
}
case 'origin':
case 'closingMotive':
case 'job':
return function ($value) use ($key) {
if ('_header' === $value) {
return 'export.list.acp.' . $key;
}
if (null === $value) {
return '';
}
if (null === $value) {
return '';
}
return $this->translatableStringHelper->localize(json_decode($value, true, 512, JSON_THROW_ON_ERROR));
},
'locationPersonName', 'requestorPerson' => function ($value) use ($key) {
if ('_header' === $value) {
return 'export.list.acp.' . $key;
}
return $this->translatableStringHelper->localize(json_decode($value, true, 512, JSON_THROW_ON_ERROR));
};
if (null === $value || null === $person = $this->personRepository->find($value)) {
return '';
}
case 'locationPersonName':
case 'requestorPerson':
return function ($value) use ($key) {
if ('_header' === $value) {
return 'export.list.acp.' . $key;
}
return $this->personRender->renderString($person, []);
},
'requestorThirdParty' => function ($value) use ($key) {
if ('_header' === $value) {
return 'export.list.acp.' . $key;
}
if (null === $value || null === $person = $this->personRepository->find($value)) {
return '';
}
if (null === $value || null === $thirdparty = $this->thirdPartyRepository->find($value)) {
return '';
}
return $this->personRender->renderString($person, []);
};
return $this->thirdPartyRender->renderString($thirdparty, []);
},
'scopes' => function ($value) use ($key) {
if ('_header' === $value) {
return 'export.list.acp.' . $key;
}
case 'requestorThirdParty':
return function ($value) use ($key) {
if ('_header' === $value) {
return 'export.list.acp.' . $key;
}
if (null === $value) {
return '';
}
if (null === $value || null === $thirdparty = $this->thirdPartyRepository->find($value)) {
return '';
}
return implode(
'|',
array_map(
fn ($s) => $this->translatableStringHelper->localize($s),
json_decode($value, true, 512, JSON_THROW_ON_ERROR)
)
);
},
'socialIssues' => function ($value) use ($key) {
if ('_header' === $value) {
return 'export.list.acp.' . $key;
}
return $this->thirdPartyRender->renderString($thirdparty, []);
};
if (null === $value) {
return '';
}
case 'scopes':
return function ($value) use ($key) {
if ('_header' === $value) {
return 'export.list.acp.' . $key;
}
return implode(
'|',
array_map(
fn ($s) => $this->socialIssueRender->renderString($this->socialIssueRepository->find($s), []),
json_decode($value, true, 512, JSON_THROW_ON_ERROR)
)
);
},
default => static function ($value) use ($key) {
if ('_header' === $value) {
return 'export.list.acp.' . $key;
}
if (null === $value) {
return '';
}
if (null === $value) {
return '';
}
return implode(
'|',
array_map(
fn ($s) => $this->translatableStringHelper->localize($s),
json_decode($value, true, 512, JSON_THROW_ON_ERROR)
)
);
};
case 'socialIssues':
return function ($value) use ($key) {
if ('_header' === $value) {
return 'export.list.acp.' . $key;
}
if (null === $value) {
return '';
}
return implode(
'|',
array_map(
fn ($s) => $this->socialIssueRender->renderString($this->socialIssueRepository->find($s), []),
json_decode($value, true, 512, JSON_THROW_ON_ERROR)
)
);
};
default:
return static function ($value) use ($key) {
if ('_header' === $value) {
return 'export.list.acp.' . $key;
}
if (null === $value) {
return '';
}
return $value;
};
}
return $value;
},
};
}
public function getQueryKeys($data)

View File

@@ -76,56 +76,8 @@ class ListAccompanyingPeriodWork implements ListInterface, GroupedExportInterfac
'updatedBy',
];
private AggregateStringHelper $aggregateStringHelper;
private DateTimeHelper $dateTimeHelper;
private EntityManagerInterface $entityManager;
private LabelPersonHelper $personHelper;
private RollingDateConverterInterface $rollingDateConverter;
private SocialActionRender $socialActionRender;
private SocialActionRepository $socialActionRepository;
private SocialIssueRender $socialIssueRender;
private SocialIssueRepository $socialIssueRepository;
private LabelThirdPartyHelper $thirdPartyHelper;
private TranslatableStringExportLabelHelper $translatableStringExportLabelHelper;
private UserHelper $userHelper;
public function __construct(
EntityManagerInterface $entityManager,
DateTimeHelper $dateTimeHelper,
UserHelper $userHelper,
LabelPersonHelper $personHelper,
LabelThirdPartyHelper $thirdPartyHelper,
TranslatableStringExportLabelHelper $translatableStringExportLabelHelper,
SocialIssueRender $socialIssueRender,
SocialIssueRepository $socialIssueRepository,
SocialActionRender $socialActionRender,
RollingDateConverterInterface $rollingDateConverter,
AggregateStringHelper $aggregateStringHelper,
SocialActionRepository $socialActionRepository
) {
$this->entityManager = $entityManager;
$this->dateTimeHelper = $dateTimeHelper;
$this->userHelper = $userHelper;
$this->personHelper = $personHelper;
$this->thirdPartyHelper = $thirdPartyHelper;
$this->translatableStringExportLabelHelper = $translatableStringExportLabelHelper;
$this->socialIssueRender = $socialIssueRender;
$this->socialIssueRepository = $socialIssueRepository;
$this->socialActionRender = $socialActionRender;
$this->rollingDateConverter = $rollingDateConverter;
$this->aggregateStringHelper = $aggregateStringHelper;
$this->socialActionRepository = $socialActionRepository;
public function __construct(private EntityManagerInterface $entityManager, private DateTimeHelper $dateTimeHelper, private UserHelper $userHelper, private LabelPersonHelper $personHelper, private LabelThirdPartyHelper $thirdPartyHelper, private TranslatableStringExportLabelHelper $translatableStringExportLabelHelper, private SocialIssueRender $socialIssueRender, private SocialIssueRepository $socialIssueRepository, private SocialActionRender $socialActionRender, private RollingDateConverterInterface $rollingDateConverter, private AggregateStringHelper $aggregateStringHelper, private SocialActionRepository $socialActionRepository)
{
}
public function buildForm(FormBuilderInterface $builder)
@@ -156,89 +108,55 @@ class ListAccompanyingPeriodWork implements ListInterface, GroupedExportInterfac
public function getLabels($key, array $values, $data)
{
switch ($key) {
case 'startDate':
case 'endDate':
case 'createdAt':
case 'updatedAt':
return $this->dateTimeHelper->getLabel('export.list.acpw.' . $key);
return match ($key) {
'startDate', 'endDate', 'createdAt', 'updatedAt' => $this->dateTimeHelper->getLabel('export.list.acpw.' . $key),
'socialAction' => function ($value) use ($key) {
if ('_header' === $value) {
return 'export.list.acpw.' . $key;
}
case 'socialAction':
return function ($value) use ($key) {
if ('_header' === $value) {
return 'export.list.acpw.' . $key;
}
if (null === $value) {
return '';
}
if (null === $value) {
return '';
}
return $this->socialActionRender->renderString(
$this->socialActionRepository->find($value),
[]
);
},
'socialIssue' => function ($value) use ($key) {
if ('_header' === $value) {
return 'export.list.acpw.' . $key;
}
return $this->socialActionRender->renderString(
$this->socialActionRepository->find($value),
[]
);
};
if (null === $value) {
return '';
}
case 'socialIssue':
return function ($value) use ($key) {
if ('_header' === $value) {
return 'export.list.acpw.' . $key;
}
return $this->socialIssueRender->renderString(
$this->socialIssueRepository->find($value),
[]
);
},
'createdBy', 'updatedBy', 'acp_user' => $this->userHelper->getLabel($key, $values, 'export.list.acpw.' . $key),
'referrers' => $this->userHelper->getLabel($key, $values, 'export.list.acpw.' . $key),
'personsName' => $this->personHelper->getLabelMulti($key, $values, 'export.list.acpw.' . $key),
'handlingThierParty' => $this->thirdPartyHelper->getLabel($key, $values, 'export.list.acpw.' . $key),
'thirdParties' => $this->thirdPartyHelper->getLabelMulti($key, $values, 'export.list.acpw.' . $key),
'personsId', 'goalsId', 'goalResultsId', 'resultsId', 'evaluationsId' => $this->aggregateStringHelper->getLabelMulti($key, $values, 'export.list.acpw.' . $key),
'goalsTitle', 'goalResultsTitle', 'resultsTitle', 'evaluationsTitle' => $this->translatableStringExportLabelHelper->getLabelMulti($key, $values, 'export.list.acpw.' . $key),
default => static function ($value) use ($key) {
if ('_header' === $value) {
return 'export.list.acpw.' . $key;
}
if (null === $value) {
return '';
}
if (null === $value) {
return '';
}
return $this->socialIssueRender->renderString(
$this->socialIssueRepository->find($value),
[]
);
};
case 'createdBy':
case 'updatedBy':
case 'acp_user':
return $this->userHelper->getLabel($key, $values, 'export.list.acpw.' . $key);
case 'referrers':
//$date = $this->rollDateConverter->convert($data['calc_date'])->format('d/m/Y');
return $this->userHelper->getLabel($key, $values, 'export.list.acpw.' . $key);
case 'personsName':
return $this->personHelper->getLabelMulti($key, $values, 'export.list.acpw.' . $key);
case 'handlingThierParty':
return $this->thirdPartyHelper->getLabel($key, $values, 'export.list.acpw.' . $key);
case 'thirdParties':
return $this->thirdPartyHelper->getLabelMulti($key, $values, 'export.list.acpw.' . $key);
case 'personsId':
case 'goalsId':
case 'goalResultsId':
case 'resultsId':
case 'evaluationsId':
return $this->aggregateStringHelper->getLabelMulti($key, $values, 'export.list.acpw.' . $key);
case 'goalsTitle':
case 'goalResultsTitle':
case 'resultsTitle':
case 'evaluationsTitle':
return $this->translatableStringExportLabelHelper->getLabelMulti($key, $values, 'export.list.acpw.' . $key);
default:
return static function ($value) use ($key) {
if ('_header' === $value) {
return 'export.list.acpw.' . $key;
}
if (null === $value) {
return '';
}
return $value;
};
}
return $value;
},
};
}
public function getQueryKeys($data)

View File

@@ -68,52 +68,8 @@ class ListEvaluation implements ListInterface, GroupedExportInterface
'updatedBy',
];
private AggregateStringHelper $aggregateStringHelper;
private DateTimeHelper $dateTimeHelper;
private EntityManagerInterface $entityManager;
private LabelPersonHelper $personHelper;
private RollingDateConverterInterface $rollingDateConverter;
private SocialActionRender $socialActionRender;
private SocialActionRepository $socialActionRepository;
private SocialIssueRender $socialIssueRender;
private SocialIssueRepository $socialIssueRepository;
private TranslatableStringExportLabelHelper $translatableStringExportLabelHelper;
private UserHelper $userHelper;
public function __construct(
EntityManagerInterface $entityManager,
SocialIssueRender $socialIssueRender,
SocialIssueRepository $socialIssueRepository,
SocialActionRender $socialActionRender,
SocialActionRepository $socialActionRepository,
UserHelper $userHelper,
LabelPersonHelper $personHelper,
DateTimeHelper $dateTimeHelper,
TranslatableStringExportLabelHelper $translatableStringExportLabelHelper,
AggregateStringHelper $aggregateStringHelper,
RollingDateConverterInterface $rollingDateConverter
) {
$this->entityManager = $entityManager;
$this->socialIssueRender = $socialIssueRender;
$this->socialIssueRepository = $socialIssueRepository;
$this->socialActionRender = $socialActionRender;
$this->socialActionRepository = $socialActionRepository;
$this->userHelper = $userHelper;
$this->personHelper = $personHelper;
$this->dateTimeHelper = $dateTimeHelper;
$this->translatableStringExportLabelHelper = $translatableStringExportLabelHelper;
$this->aggregateStringHelper = $aggregateStringHelper;
$this->rollingDateConverter = $rollingDateConverter;
public function __construct(private EntityManagerInterface $entityManager, private SocialIssueRender $socialIssueRender, private SocialIssueRepository $socialIssueRepository, private SocialActionRender $socialActionRender, private SocialActionRepository $socialActionRepository, private UserHelper $userHelper, private LabelPersonHelper $personHelper, private DateTimeHelper $dateTimeHelper, private TranslatableStringExportLabelHelper $translatableStringExportLabelHelper, private AggregateStringHelper $aggregateStringHelper, private RollingDateConverterInterface $rollingDateConverter)
{
}
public function buildForm(FormBuilderInterface $builder)
@@ -144,79 +100,54 @@ class ListEvaluation implements ListInterface, GroupedExportInterface
public function getLabels($key, array $values, $data)
{
switch ($key) {
case 'startDate':
case 'endDate':
case 'maxDate':
case 'acpw_startDate':
case 'acpw_endDate':
case 'createdAt':
case 'updatedAt':
return $this->dateTimeHelper->getLabel('export.list.eval.' . $key);
return match ($key) {
'startDate', 'endDate', 'maxDate', 'acpw_startDate', 'acpw_endDate', 'createdAt', 'updatedAt' => $this->dateTimeHelper->getLabel('export.list.eval.' . $key),
'acpw_socialaction' => function ($value) use ($key) {
if ('_header' === $value) {
return 'export.list.eval.' . $key;
}
case 'acpw_socialaction':
return function ($value) use ($key) {
if ('_header' === $value) {
return 'export.list.eval.' . $key;
}
if (null === $value || '' === $value) {
return '';
}
if (null === $value || '' === $value) {
return '';
}
return $this->socialActionRender->renderString(
$this->socialActionRepository->find($value),
[]
);
},
'acpw_socialissue' => function ($value) use ($key) {
if ('_header' === $value) {
return 'export.list.eval.' . $key;
}
return $this->socialActionRender->renderString(
$this->socialActionRepository->find($value),
[]
);
};
if (null === $value || '' === $value) {
return '';
}
case 'acpw_socialissue':
return function ($value) use ($key) {
if ('_header' === $value) {
return 'export.list.eval.' . $key;
}
return $this->socialIssueRender->renderString(
$this->socialIssueRepository->find($value),
[]
);
},
'createdBy', 'updatedBy', 'acpw_acp_user' => $this->userHelper->getLabel($key, $values, 'export.list.eval.' . $key),
'acpw_referrers' => $this->userHelper->getLabel($key, $values, 'export.list.eval.' . $key),
'acpw_persons_id' => $this->aggregateStringHelper->getLabelMulti($key, $values, 'export.list.eval.' . $key),
'acpw_persons' => $this->personHelper->getLabelMulti($key, $values, 'export.list.eval.' . $key),
'eval_title' => $this->translatableStringExportLabelHelper
->getLabel($key, $values, 'export.list.eval.' . $key),
default => static function ($value) use ($key) {
if ('_header' === $value) {
return 'export.list.eval.' . $key;
}
if (null === $value || '' === $value) {
return '';
}
if (null === $value) {
return '';
}
return $this->socialIssueRender->renderString(
$this->socialIssueRepository->find($value),
[]
);
};
case 'createdBy':
case 'updatedBy':
case 'acpw_acp_user':
return $this->userHelper->getLabel($key, $values, 'export.list.eval.' . $key);
case 'acpw_referrers':
return $this->userHelper->getLabel($key, $values, 'export.list.eval.' . $key);
case 'acpw_persons_id':
return $this->aggregateStringHelper->getLabelMulti($key, $values, 'export.list.eval.' . $key);
case 'acpw_persons':
return $this->personHelper->getLabelMulti($key, $values, 'export.list.eval.' . $key);
case 'eval_title':
return $this->translatableStringExportLabelHelper
->getLabel($key, $values, 'export.list.eval.' . $key);
default:
return static function ($value) use ($key) {
if ('_header' === $value) {
return 'export.list.eval.' . $key;
}
if (null === $value) {
return '';
}
return $value;
};
}
return $value;
},
};
}
public function getQueryKeys($data)

View File

@@ -45,28 +45,8 @@ class ListHouseholdInPeriod implements ListInterface, GroupedExportInterface
'compositionType',
];
private ExportAddressHelper $addressHelper;
private AggregateStringHelper $aggregateStringHelper;
private EntityManagerInterface $entityManager;
private RollingDateConverterInterface $rollingDateConverter;
private TranslatableStringExportLabelHelper $translatableStringHelper;
public function __construct(
ExportAddressHelper $addressHelper,
AggregateStringHelper $aggregateStringHelper,
EntityManagerInterface $entityManager,
RollingDateConverterInterface $rollingDateConverter,
TranslatableStringExportLabelHelper $translatableStringHelper
) {
$this->addressHelper = $addressHelper;
$this->aggregateStringHelper = $aggregateStringHelper;
$this->entityManager = $entityManager;
$this->rollingDateConverter = $rollingDateConverter;
$this->translatableStringHelper = $translatableStringHelper;
public function __construct(private ExportAddressHelper $addressHelper, private AggregateStringHelper $aggregateStringHelper, private EntityManagerInterface $entityManager, private RollingDateConverterInterface $rollingDateConverter, private TranslatableStringExportLabelHelper $translatableStringHelper)
{
}
public function buildForm(FormBuilderInterface $builder)
@@ -97,28 +77,21 @@ class ListHouseholdInPeriod implements ListInterface, GroupedExportInterface
public function getLabels($key, array $values, $data)
{
if (substr($key, 0, strlen('address_fields')) === 'address_fields') {
if (str_starts_with($key, 'address_fields')) {
return $this->addressHelper->getLabel($key, $values, $data, 'address_fields');
}
switch ($key) {
case 'membersId':
case 'membersName':
return $this->aggregateStringHelper->getLabelMulti($key, $values, 'export.list.household.' . $key);
return match ($key) {
'membersId', 'membersName' => $this->aggregateStringHelper->getLabelMulti($key, $values, 'export.list.household.' . $key),
'compositionType' => $this->translatableStringHelper->getLabel($key, $values, 'export.list.household.' . $key),
default => static function ($value) use ($key) {
if ('_header' === $value) {
return 'export.list.household.' . $key;
}
case 'compositionType':
//dump($values);
return $this->translatableStringHelper->getLabel($key, $values, 'export.list.household.' . $key);
default:
return static function ($value) use ($key) {
if ('_header' === $value) {
return 'export.list.household.' . $key;
}
return (string) $value;
};
}
return (string) $value;
},
};
}
public function getQueryKeys($data): array

View File

@@ -48,30 +48,10 @@ use function uniqid;
*/
class ListPerson implements ExportElementValidatedInterface, ListInterface, GroupedExportInterface
{
private ExportAddressHelper $addressHelper;
private CustomFieldProvider $customFieldProvider;
private EntityManagerInterface $entityManager;
private ListPersonHelper $listPersonHelper;
private $slugs = [];
private TranslatableStringHelper $translatableStringHelper;
public function __construct(
ExportAddressHelper $addressHelper,
CustomFieldProvider $customFieldProvider,
ListPersonHelper $listPersonHelper,
EntityManagerInterface $em,
TranslatableStringHelper $translatableStringHelper
) {
$this->addressHelper = $addressHelper;
$this->customFieldProvider = $customFieldProvider;
$this->listPersonHelper = $listPersonHelper;
$this->entityManager = $em;
$this->translatableStringHelper = $translatableStringHelper;
public function __construct(private ExportAddressHelper $addressHelper, private CustomFieldProvider $customFieldProvider, private ListPersonHelper $listPersonHelper, private EntityManagerInterface $entityManager, private TranslatableStringHelper $translatableStringHelper)
{
}
public function buildForm(FormBuilderInterface $builder)
@@ -92,7 +72,7 @@ class ListPerson implements ExportElementValidatedInterface, ListInterface, Grou
'label' => 'Fields to include in export',
'choice_attr' => static function (string $val): array {
// add a 'data-display-target' for address fields
if (substr($val, 0, 7) === 'address' || 'center' === $val || 'household' === $val) {
if (str_starts_with($val, 'address') || 'center' === $val || 'household' === $val) {
return ['data-display-target' => 'address_date'];
}
@@ -152,7 +132,7 @@ class ListPerson implements ExportElementValidatedInterface, ListInterface, Grou
continue;
}
if (substr($key, 0, strlen('address_fields')) === 'address_fields') {
if (str_starts_with($key, 'address_fields')) {
$fields = array_merge($fields, $this->addressHelper->getKeys(ExportAddressHelper::F_ALL, 'address_fields'));
continue;
@@ -264,7 +244,7 @@ class ListPerson implements ExportElementValidatedInterface, ListInterface, Grou
// get the field starting with address_
$addressFields = array_filter(
ListPersonHelper::FIELDS,
static fn (string $el): bool => substr($el, 0, 8) === 'address_'
static fn (string $el): bool => str_starts_with($el, 'address_')
);
// check if there is one field starting with address in data
@@ -285,11 +265,9 @@ class ListPerson implements ExportElementValidatedInterface, ListInterface, Grou
}
/**
* @param mixed $slug
*
* @return array An array with keys = 'slug', 'type', 'additionnalInfo'
*/
private function extractInfosFromSlug($slug): array
private function extractInfosFromSlug(mixed $slug): array
{
return $this->slugs[$slug];
}

View File

@@ -47,25 +47,13 @@ class ListPersonDuplicate implements DirectExportInterface, ExportElementValidat
*/
protected $entityManager;
/**
* @var \Symfony\Component\Routing\Generator\UrlGeneratorInterface
*/
private $router;
/**
* @var \Symfony\Component\Translation\TranslatorInterface
*/
private $translator;
public function __construct(
EntityManagerInterface $em,
TranslatorInterface $translator,
UrlGeneratorInterface $router,
private TranslatorInterface $translator,
private UrlGeneratorInterface $router,
$routeParameters
) {
$this->entityManager = $em;
$this->translator = $translator;
$this->router = $router;
$this->baseUrl = $routeParameters['scheme'] .
'://' . $routeParameters['host'];
}

View File

@@ -37,20 +37,8 @@ use function strlen;
class ListPersonWithAccompanyingPeriod implements ExportElementValidatedInterface, ListInterface, GroupedExportInterface
{
private ExportAddressHelper $addressHelper;
private EntityManagerInterface $entityManager;
private ListPersonHelper $listPersonHelper;
public function __construct(
ExportAddressHelper $addressHelper,
ListPersonHelper $listPersonHelper,
EntityManagerInterface $em
) {
$this->addressHelper = $addressHelper;
$this->listPersonHelper = $listPersonHelper;
$this->entityManager = $em;
public function __construct(private ExportAddressHelper $addressHelper, private ListPersonHelper $listPersonHelper, private EntityManagerInterface $entityManager)
{
}
public function buildForm(FormBuilderInterface $builder)
@@ -65,7 +53,7 @@ class ListPersonWithAccompanyingPeriod implements ExportElementValidatedInterfac
'label' => 'Fields to include in export',
'choice_attr' => static function (string $val): array {
// add a 'data-display-target' for address fields
if (substr($val, 0, 7) === 'address' || 'center' === $val || 'household' === $val) {
if (str_starts_with($val, 'address') || 'center' === $val || 'household' === $val) {
return ['data-display-target' => 'address_date'];
}
@@ -121,7 +109,7 @@ class ListPersonWithAccompanyingPeriod implements ExportElementValidatedInterfac
continue;
}
if (substr($key, 0, strlen('address_fields')) === 'address_fields') {
if (str_starts_with($key, 'address_fields')) {
$fields = array_merge($fields, $this->addressHelper->getKeys(ExportAddressHelper::F_ALL, 'address_fields'));
continue;
@@ -201,7 +189,7 @@ class ListPersonWithAccompanyingPeriod implements ExportElementValidatedInterfac
// get the field starting with address_
$addressFields = array_filter(
ListPersonHelper::FIELDS,
static fn (string $el): bool => substr($el, 0, 8) === 'address_'
static fn (string $el): bool => str_starts_with($el, 'address_')
);
// check if there is one field starting with address in data

View File

@@ -64,22 +64,13 @@ class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportIn
{
return static function ($value) use ($key) {
if ('_header' === $value) {
switch ($key) {
case 'avg_export_result':
return 'export.export.acp_stats.avg_duration';
case 'count_acppart_export_result':
return 'export.export.acp_stats.count_participations';
case 'count_acp_export_result':
return 'export.export.acp_stats.count_acps';
case 'count_pers_export_result':
return 'export.export.acp_stats.count_persons';
default:
throw new LogicException('key not supported: ' . $key);
}
return match ($key) {
'avg_export_result' => 'export.export.acp_stats.avg_duration',
'count_acppart_export_result' => 'export.export.acp_stats.count_participations',
'count_acp_export_result' => 'export.export.acp_stats.count_acps',
'count_pers_export_result' => 'export.export.acp_stats.count_persons',
default => throw new LogicException('key not supported: ' . $key),
};
}
if (null === $value) {

View File

@@ -22,11 +22,8 @@ use Symfony\Component\Form\FormBuilderInterface;
class ActiveOnDateFilter implements FilterInterface
{
private RollingDateConverterInterface $rollingDateConverter;
public function __construct(RollingDateConverterInterface $rollingDateConverter)
public function __construct(private RollingDateConverterInterface $rollingDateConverter)
{
$this->rollingDateConverter = $rollingDateConverter;
}
public function addRole(): ?string

View File

@@ -21,11 +21,8 @@ use Symfony\Component\Form\FormBuilderInterface;
class ActiveOneDayBetweenDatesFilter implements FilterInterface
{
private RollingDateConverterInterface $rollingDateConverter;
public function __construct(RollingDateConverterInterface $rollingDateConverter)
public function __construct(private RollingDateConverterInterface $rollingDateConverter)
{
$this->rollingDateConverter = $rollingDateConverter;
}
public function addRole(): ?string

View File

@@ -20,12 +20,8 @@ use Symfony\Component\Form\FormBuilderInterface;
class AdministrativeLocationFilter implements FilterInterface
{
private TranslatableStringHelper $translatableStringHelper;
public function __construct(
TranslatableStringHelper $translatableStringHelper
) {
$this->translatableStringHelper = $translatableStringHelper;
public function __construct(private TranslatableStringHelper $translatableStringHelper)
{
}
public function addRole(): ?string

View File

@@ -22,12 +22,8 @@ use Symfony\Component\Form\FormBuilderInterface;
class ClosingMotiveFilter implements FilterInterface
{
private TranslatableStringHelper $translatableStringHelper;
public function __construct(
TranslatableStringHelper $translatableStringHelper
) {
$this->translatableStringHelper = $translatableStringHelper;
public function __construct(private TranslatableStringHelper $translatableStringHelper)
{
}
public function addRole(): ?string

View File

@@ -28,11 +28,8 @@ class ConfidentialFilter implements FilterInterface
private const DEFAULT_CHOICE = false;
private TranslatorInterface $translator;
public function __construct(TranslatorInterface $translator)
public function __construct(private TranslatorInterface $translator)
{
$this->translator = $translator;
}
public function addRole(): ?string

View File

@@ -23,16 +23,8 @@ use function in_array;
class CreatorJobFilter implements FilterInterface
{
private TranslatableStringHelper $translatableStringHelper;
private UserJobRepositoryInterface $userJobRepository;
public function __construct(
TranslatableStringHelper $translatableStringHelper,
UserJobRepositoryInterface $userJobRepository
) {
$this->translatableStringHelper = $translatableStringHelper;
$this->userJobRepository = $userJobRepository;
public function __construct(private TranslatableStringHelper $translatableStringHelper, private UserJobRepositoryInterface $userJobRepository)
{
}
public function addRole(): ?string

View File

@@ -28,11 +28,8 @@ class EmergencyFilter implements FilterInterface
private const DEFAULT_CHOICE = false;
private TranslatorInterface $translator;
public function __construct(TranslatorInterface $translator)
public function __construct(private TranslatorInterface $translator)
{
$this->translator = $translator;
}
public function addRole(): ?string

View File

@@ -23,16 +23,8 @@ use function in_array;
class EvaluationFilter implements FilterInterface
{
private EvaluationRepositoryInterface $evaluationRepository;
private TranslatableStringHelper $translatableStringHelper;
public function __construct(
EvaluationRepositoryInterface $evaluationRepository,
TranslatableStringHelper $translatableStringHelper
) {
$this->evaluationRepository = $evaluationRepository;
$this->translatableStringHelper = $translatableStringHelper;
public function __construct(private EvaluationRepositoryInterface $evaluationRepository, private TranslatableStringHelper $translatableStringHelper)
{
}
public function addRole(): ?string

View File

@@ -32,24 +32,8 @@ use Symfony\Component\Form\FormBuilderInterface;
*/
class GeographicalUnitStatFilter implements FilterInterface
{
private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository;
private GeographicalUnitRepositoryInterface $geographicalUnitRepository;
private RollingDateConverterInterface $rollingDateConverter;
private TranslatableStringHelperInterface $translatableStringHelper;
public function __construct(
GeographicalUnitRepositoryInterface $geographicalUnitRepository,
GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository,
TranslatableStringHelperInterface $translatableStringHelper,
RollingDateConverterInterface $rollingDateConverter
) {
$this->geographicalUnitRepository = $geographicalUnitRepository;
$this->geographicalUnitLayerRepository = $geographicalUnitLayerRepository;
$this->translatableStringHelper = $translatableStringHelper;
$this->rollingDateConverter = $rollingDateConverter;
public function __construct(private GeographicalUnitRepositoryInterface $geographicalUnitRepository, private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private TranslatableStringHelperInterface $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter)
{
}
public function addRole(): ?string

View File

@@ -22,12 +22,8 @@ use Symfony\Component\Form\FormBuilderInterface;
class HasNoReferrerFilter implements FilterInterface
{
private RollingDateConverterInterface $rollingDateConverter;
public function __construct(
RollingDateConverterInterface $rollingDateConverter
) {
$this->rollingDateConverter = $rollingDateConverter;
public function __construct(private RollingDateConverterInterface $rollingDateConverter)
{
}
public function addRole(): ?string

View File

@@ -23,12 +23,8 @@ use Symfony\Component\Form\FormBuilderInterface;
class HasTemporaryLocationFilter implements FilterInterface
{
private RollingDateConverterInterface $rollingDateConverter;
public function __construct(
RollingDateConverterInterface $rollingDateConverter
) {
$this->rollingDateConverter = $rollingDateConverter;
public function __construct(private RollingDateConverterInterface $rollingDateConverter)
{
}
public function addRole(): ?string
@@ -47,20 +43,11 @@ class HasTemporaryLocationFilter implements FilterInterface
$this->rollingDateConverter->convert($data['calc_date'])
);
switch ($data['having_temporarily']) {
case true:
$qb->andWhere('acp_having_temporarily_location.addressLocation IS NOT NULL');
break;
case false:
$qb->andWhere('acp_having_temporarily_location.personLocation IS NOT NULL');
break;
default:
throw new LogicException('value not supported');
}
match ($data['having_temporarily']) {
true => $qb->andWhere('acp_having_temporarily_location.addressLocation IS NOT NULL'),
false => $qb->andWhere('acp_having_temporarily_location.personLocation IS NOT NULL'),
default => throw new LogicException('value not supported'),
};
}
public function applyOn(): string
@@ -77,17 +64,10 @@ class HasTemporaryLocationFilter implements FilterInterface
'export.filter.course.having_temporarily.Having a temporarily location' => true,
'export.filter.course.having_temporarily.Having a person\'s location' => false,
],
'choice_label' => static function ($choice) {
switch ($choice) {
case true:
return 'export.filter.course.having_temporarily.Having a temporarily location';
case false:
return 'export.filter.course.having_temporarily.Having a person\'s location';
default:
throw new LogicException('this choice is not supported');
}
'choice_label' => static fn ($choice) => match ($choice) {
true => 'export.filter.course.having_temporarily.Having a temporarily location',
false => 'export.filter.course.having_temporarily.Having a person\'s location',
default => throw new LogicException('this choice is not supported'),
},
])
->add('calc_date', PickRollingDateType::class, [
@@ -98,16 +78,11 @@ class HasTemporaryLocationFilter implements FilterInterface
public function describeAction($data, $format = 'string'): array
{
switch ($data['having_temporarily']) {
case true:
return ['export.filter.course.having_temporarily.Having a temporarily location', []];
case false:
return ['export.filter.course.having_temporarily.Having a person\'s location', []];
default:
throw new LogicException('value not supported');
}
return match ($data['having_temporarily']) {
true => ['export.filter.course.having_temporarily.Having a temporarily location', []],
false => ['export.filter.course.having_temporarily.Having a person\'s location', []],
default => throw new LogicException('value not supported'),
};
}
public function getTitle(): string

View File

@@ -28,11 +28,8 @@ class IntensityFilter implements FilterInterface
private const DEFAULT_CHOICE = 'occasional';
private TranslatorInterface $translator;
public function __construct(TranslatorInterface $translator)
public function __construct(private TranslatorInterface $translator)
{
$this->translator = $translator;
}
public function addRole(): ?string

View File

@@ -22,11 +22,8 @@ use Symfony\Component\Form\FormBuilderInterface;
class OpenBetweenDatesFilter implements FilterInterface
{
private RollingDateConverterInterface $rollingDateConverter;
public function __construct(RollingDateConverterInterface $rollingDateConverter)
public function __construct(private RollingDateConverterInterface $rollingDateConverter)
{
$this->rollingDateConverter = $rollingDateConverter;
}
public function addRole(): ?string

View File

@@ -22,12 +22,8 @@ use Symfony\Component\Form\FormBuilderInterface;
class OriginFilter implements FilterInterface
{
private TranslatableStringHelper $translatableStringHelper;
public function __construct(
TranslatableStringHelper $translatableStringHelper
) {
$this->translatableStringHelper = $translatableStringHelper;
public function __construct(private TranslatableStringHelper $translatableStringHelper)
{
}
public function addRole(): ?string

View File

@@ -29,12 +29,8 @@ class ReferrerFilter implements FilterInterface
private const PU = 'acp_referrer_filter_users';
private RollingDateConverterInterface $rollingDateConverter;
public function __construct(
RollingDateConverterInterface $rollingDateConverter
) {
$this->rollingDateConverter = $rollingDateConverter;
public function __construct(private RollingDateConverterInterface $rollingDateConverter)
{
}
public function addRole(): ?string

View File

@@ -33,16 +33,8 @@ final class RequestorFilter implements FilterInterface
'no requestor' => 'no_requestor',
];
private EntityManagerInterface $em;
private TranslatorInterface $translator;
public function __construct(
TranslatorInterface $translator,
EntityManagerInterface $em
) {
$this->translator = $translator;
$this->em = $em;
public function __construct(private TranslatorInterface $translator, private EntityManagerInterface $em)
{
}
public function addRole(): ?string

View File

@@ -23,16 +23,8 @@ use function in_array;
class SocialActionFilter implements FilterInterface
{
private SocialActionRender $actionRender;
private TranslatableStringHelper $translatableStringHelper;
public function __construct(
TranslatableStringHelper $translatableStringHelper,
SocialActionRender $actionRender
) {
$this->translatableStringHelper = $translatableStringHelper;
$this->actionRender = $actionRender;
public function __construct(private TranslatableStringHelper $translatableStringHelper, private SocialActionRender $actionRender)
{
}
public function addRole(): ?string

View File

@@ -28,14 +28,11 @@ class SocialIssueFilter implements FilterInterface
*/
protected $translator;
private SocialIssueRender $socialIssueRender;
public function __construct(
TranslatorInterface $translator,
SocialIssueRender $socialIssueRender
private SocialIssueRender $socialIssueRender
) {
$this->translator = $translator;
$this->socialIssueRender = $socialIssueRender;
}
public function addRole(): ?string

View File

@@ -37,19 +37,8 @@ class StepFilter implements FilterInterface
'Closed' => AccompanyingPeriod::STEP_CLOSED,
];
private RollingDateConverterInterface $rollingDateConverter;
/**
* @var TranslatorInterface
*/
private $translator;
public function __construct(
RollingDateConverterInterface $rollingDateConverter,
TranslatorInterface $translator
) {
$this->rollingDateConverter = $rollingDateConverter;
$this->translator = $translator;
public function __construct(private RollingDateConverterInterface $rollingDateConverter, private TranslatorInterface $translator)
{
}
public function addRole(): ?string

View File

@@ -34,20 +34,8 @@ class UserJobFilter implements FilterInterface
private const PJ = 'acp_ujob_filter_job';
private RollingDateConverterInterface $rollingDateConverter;
private TranslatableStringHelper $translatableStringHelper;
private UserJobRepositoryInterface $userJobRepository;
public function __construct(
TranslatableStringHelper $translatableStringHelper,
UserJobRepositoryInterface $userJobRepository,
RollingDateConverterInterface $rollingDateConverter
) {
$this->translatableStringHelper = $translatableStringHelper;
$this->userJobRepository = $userJobRepository;
$this->rollingDateConverter = $rollingDateConverter;
public function __construct(private TranslatableStringHelper $translatableStringHelper, private UserJobRepositoryInterface $userJobRepository, private RollingDateConverterInterface $rollingDateConverter)
{
}
public function addRole(): ?string

View File

@@ -35,24 +35,8 @@ class UserScopeFilter implements FilterInterface
private const PS = 'acp_uscope_filter_scopes';
private RollingDateConverterInterface $rollingDateConverter;
private ScopeRepositoryInterface $scopeRepository;
private Security $security;
private TranslatableStringHelper $translatableStringHelper;
public function __construct(
ScopeRepositoryInterface $scopeRepository,
Security $security,
TranslatableStringHelper $translatableStringHelper,
RollingDateConverterInterface $rollingDateConverter
) {
$this->scopeRepository = $scopeRepository;
$this->security = $security;
$this->translatableStringHelper = $translatableStringHelper;
$this->rollingDateConverter = $rollingDateConverter;
public function __construct(private ScopeRepositoryInterface $scopeRepository, private Security $security, private TranslatableStringHelper $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter)
{
}
public function addRole(): ?string

View File

@@ -21,11 +21,8 @@ use Symfony\Component\Form\FormBuilderInterface;
class ByEndDateFilter implements FilterInterface
{
private RollingDateConverterInterface $rollingDateConverter;
public function __construct(RollingDateConverterInterface $rollingDateConverter)
public function __construct(private RollingDateConverterInterface $rollingDateConverter)
{
$this->rollingDateConverter = $rollingDateConverter;
}
public function addRole(): ?string

View File

@@ -21,11 +21,8 @@ use Symfony\Component\Form\FormBuilderInterface;
class ByStartDateFilter implements FilterInterface
{
private RollingDateConverterInterface $rollingDateConverter;
public function __construct(RollingDateConverterInterface $rollingDateConverter)
public function __construct(private RollingDateConverterInterface $rollingDateConverter)
{
$this->rollingDateConverter = $rollingDateConverter;
}
public function addRole(): ?string

View File

@@ -22,12 +22,8 @@ use Symfony\Component\Form\FormBuilderInterface;
final class EvaluationTypeFilter implements FilterInterface
{
private TranslatableStringHelper $translatableStringHelper;
public function __construct(
TranslatableStringHelper $translatableStringHelper
) {
$this->translatableStringHelper = $translatableStringHelper;
public function __construct(private TranslatableStringHelper $translatableStringHelper)
{
}
public function addRole(): ?string

View File

@@ -25,11 +25,8 @@ class MaxDateFilter implements FilterInterface
'maxdate is not specified' => false,
];
private TranslatorInterface $translator;
public function __construct(TranslatorInterface $translator)
public function __construct(private TranslatorInterface $translator)
{
$this->translator = $translator;
}
public function addRole(): ?string

View File

@@ -26,16 +26,8 @@ use function in_array;
class CompositionFilter implements FilterInterface
{
private RollingDateConverterInterface $rollingDateConverter;
private TranslatableStringHelper $translatableStringHelper;
public function __construct(
TranslatableStringHelper $translatableStringHelper,
RollingDateConverterInterface $rollingDateConverter
) {
$this->translatableStringHelper = $translatableStringHelper;
$this->rollingDateConverter = $rollingDateConverter;
public function __construct(private TranslatableStringHelper $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter)
{
}
public function addRole(): ?string

View File

@@ -24,13 +24,8 @@ use Symfony\Component\Form\FormBuilderInterface;
class AddressRefStatusFilter implements \Chill\MainBundle\Export\FilterInterface
{
private RollingDateConverterInterface $rollingDateConverter;
public function __construct(
RollingDateConverterInterface $rollingDateConverter
) {
$this->rollingDateConverter = $rollingDateConverter;
public function __construct(private RollingDateConverterInterface $rollingDateConverter)
{
}
public function addRole(): ?string

View File

@@ -26,11 +26,8 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
class AgeFilter implements ExportElementValidatedInterface, FilterInterface
{
private RollingDateConverterInterface $rollingDateConverter;
public function __construct(RollingDateConverterInterface $rollingDateConverter)
public function __construct(private RollingDateConverterInterface $rollingDateConverter)
{
$this->rollingDateConverter = $rollingDateConverter;
}
public function addRole(): ?string

View File

@@ -24,11 +24,8 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
class BirthdateFilter implements ExportElementValidatedInterface, FilterInterface
{
private RollingDateConverterInterface $rollingDateConverter;
public function __construct(RollingDateConverterInterface $rollingDateConverter)
public function __construct(private RollingDateConverterInterface $rollingDateConverter)
{
$this->rollingDateConverter = $rollingDateConverter;
}
public function addRole(): ?string

View File

@@ -28,20 +28,8 @@ use Symfony\Component\Form\FormBuilderInterface;
class ByHouseholdCompositionFilter implements FilterInterface
{
private HouseholdCompositionTypeRepositoryInterface $householdCompositionTypeRepository;
private RollingDateConverterInterface $rollingDateConverter;
private TranslatableStringHelperInterface $translatableStringHelper;
public function __construct(
HouseholdCompositionTypeRepositoryInterface $householdCompositionTypeRepository,
RollingDateConverterInterface $rollingDateConverter,
TranslatableStringHelperInterface $translatableStringHelper
) {
$this->householdCompositionTypeRepository = $householdCompositionTypeRepository;
$this->rollingDateConverter = $rollingDateConverter;
$this->translatableStringHelper = $translatableStringHelper;
public function __construct(private HouseholdCompositionTypeRepositoryInterface $householdCompositionTypeRepository, private RollingDateConverterInterface $rollingDateConverter, private TranslatableStringHelperInterface $translatableStringHelper)
{
}
public function addRole(): ?string

View File

@@ -23,12 +23,8 @@ use Symfony\Component\Form\FormBuilderInterface;
class DeadOrAliveFilter implements FilterInterface
{
private RollingDateConverterInterface $rollingDateConverter;
public function __construct(
RollingDateConverterInterface $rollingDateConverter
) {
$this->rollingDateConverter = $rollingDateConverter;
public function __construct(private RollingDateConverterInterface $rollingDateConverter)
{
}
public function addRole(): ?string

View File

@@ -24,12 +24,8 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
class DeathdateFilter implements ExportElementValidatedInterface, FilterInterface
{
private RollingDateConverterInterface $rollingDateConverter;
public function __construct(
RollingDateConverterInterface $rollingDateConverter
) {
$this->rollingDateConverter = $rollingDateConverter;
public function __construct(private RollingDateConverterInterface $rollingDateConverter)
{
}
public function addRole(): ?string

View File

@@ -26,24 +26,8 @@ use Symfony\Component\Form\FormBuilderInterface;
class GeographicalUnitFilter implements \Chill\MainBundle\Export\FilterInterface
{
private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository;
private GeographicalUnitRepositoryInterface $geographicalUnitRepository;
private RollingDateConverterInterface $rollingDateConverter;
private TranslatableStringHelperInterface $translatableStringHelper;
public function __construct(
GeographicalUnitRepositoryInterface $geographicalUnitRepository,
GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository,
TranslatableStringHelperInterface $translatableStringHelper,
RollingDateConverterInterface $rollingDateConverter
) {
$this->geographicalUnitRepository = $geographicalUnitRepository;
$this->geographicalUnitLayerRepository = $geographicalUnitLayerRepository;
$this->translatableStringHelper = $translatableStringHelper;
$this->rollingDateConverter = $rollingDateConverter;
public function __construct(private GeographicalUnitRepositoryInterface $geographicalUnitRepository, private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private TranslatableStringHelperInterface $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter)
{
}
public function addRole(): ?string

View File

@@ -19,12 +19,8 @@ use Symfony\Bridge\Doctrine\Form\Type\EntityType;
class MaritalStatusFilter implements FilterInterface
{
private TranslatableStringHelper $translatableStringHelper;
public function __construct(
TranslatableStringHelper $translatableStringHelper
) {
$this->translatableStringHelper = $translatableStringHelper;
public function __construct(private TranslatableStringHelper $translatableStringHelper)
{
}
public function addRole(): ?string

View File

@@ -26,14 +26,8 @@ class NationalityFilter implements
ExportElementValidatedInterface,
FilterInterface
{
/**
* @var TranslatableStringHelper
*/
private $translatableStringHelper;
public function __construct(TranslatableStringHelper $helper)
public function __construct(private TranslatableStringHelper $translatableStringHelper)
{
$this->translatableStringHelper = $helper;
}
public function addRole(): ?string

View File

@@ -27,16 +27,8 @@ use function in_array;
class ResidentialAddressAtThirdpartyFilter implements FilterInterface
{
private RollingDateConverterInterface $rollingDateConverter;
private TranslatableStringHelper $translatableStringHelper;
public function __construct(
RollingDateConverterInterface $rollingDateConverter,
TranslatableStringHelper $translatableStringHelper
) {
$this->translatableStringHelper = $translatableStringHelper;
$this->rollingDateConverter = $rollingDateConverter;
public function __construct(private RollingDateConverterInterface $rollingDateConverter, private TranslatableStringHelper $translatableStringHelper)
{
}
public function addRole(): ?string

View File

@@ -24,12 +24,8 @@ use function in_array;
class ResidentialAddressAtUserFilter implements FilterInterface
{
private RollingDateConverterInterface $rollingDateConverter;
public function __construct(
RollingDateConverterInterface $rollingDateConverter
) {
$this->rollingDateConverter = $rollingDateConverter;
public function __construct(private RollingDateConverterInterface $rollingDateConverter)
{
}
public function addRole(): ?string

View File

@@ -24,12 +24,8 @@ use Symfony\Component\Form\FormBuilderInterface;
class WithoutHouseholdComposition implements FilterInterface
{
private RollingDateConverterInterface $rollingDateConverter;
public function __construct(
RollingDateConverterInterface $rollingDateConverter
) {
$this->rollingDateConverter = $rollingDateConverter;
public function __construct(private RollingDateConverterInterface $rollingDateConverter)
{
}
public function addRole(): ?string

View File

@@ -24,16 +24,8 @@ use function in_array;
class JobFilter implements FilterInterface
{
protected TranslatorInterface $translator;
private TranslatableStringHelper $translatableStringHelper;
public function __construct(
TranslatorInterface $translator,
TranslatableStringHelper $translatableStringHelper
) {
$this->translator = $translator;
$this->translatableStringHelper = $translatableStringHelper;
public function __construct(protected TranslatorInterface $translator, private TranslatableStringHelper $translatableStringHelper)
{
}
public function addRole(): ?string

View File

@@ -24,16 +24,8 @@ use function in_array;
class ScopeFilter implements FilterInterface
{
protected TranslatorInterface $translator;
private TranslatableStringHelper $translatableStringHelper;
public function __construct(
TranslatorInterface $translator,
TranslatableStringHelper $translatableStringHelper
) {
$this->translator = $translator;
$this->translatableStringHelper = $translatableStringHelper;
public function __construct(protected TranslatorInterface $translator, private TranslatableStringHelper $translatableStringHelper)
{
}
public function addRole(): ?string

View File

@@ -28,20 +28,8 @@ use function in_array;
class SocialWorkTypeFilter implements FilterInterface
{
private EntityManagerInterface $em;
private SocialActionRender $socialActionRender;
private TranslatableStringHelper $translatableStringHelper;
public function __construct(
SocialActionRender $socialActionRender,
TranslatableStringHelper $translatableStringHelper,
EntityManagerInterface $em
) {
$this->socialActionRender = $socialActionRender;
$this->translatableStringHelper = $translatableStringHelper;
$this->em = $em;
public function __construct(private SocialActionRender $socialActionRender, private TranslatableStringHelper $translatableStringHelper, private EntityManagerInterface $em)
{
}
public function addRole(): ?string

View File

@@ -18,14 +18,8 @@ use const SORT_NUMERIC;
class LabelPersonHelper
{
private PersonRenderInterface $personRender;
private PersonRepository $personRepository;
public function __construct(PersonRepository $personRepository, PersonRenderInterface $personRender)
public function __construct(private PersonRepository $personRepository, private PersonRenderInterface $personRender)
{
$this->personRepository = $personRepository;
$this->personRender = $personRender;
}
public function getLabelMulti(string $key, array $values, string $header): callable

View File

@@ -73,44 +73,8 @@ class ListPersonHelper
'lifecycleUpdate',
];
private ExportAddressHelper $addressHelper;
private CenterRepositoryInterface $centerRepository;
private CivilityRepositoryInterface $civilityRepository;
private CountryRepository $countryRepository;
private LanguageRepositoryInterface $languageRepository;
private MaritalStatusRepositoryInterface $maritalStatusRepository;
private TranslatableStringHelper $translatableStringHelper;
private TranslatorInterface $translator;
private UserRepositoryInterface $userRepository;
public function __construct(
ExportAddressHelper $addressHelper,
CenterRepositoryInterface $centerRepository,
CivilityRepositoryInterface $civilityRepository,
CountryRepository $countryRepository,
LanguageRepositoryInterface $languageRepository,
MaritalStatusRepositoryInterface $maritalStatusRepository,
TranslatableStringHelper $translatableStringHelper,
TranslatorInterface $translator,
UserRepositoryInterface $userRepository
) {
$this->addressHelper = $addressHelper;
$this->centerRepository = $centerRepository;
$this->civilityRepository = $civilityRepository;
$this->countryRepository = $countryRepository;
$this->languageRepository = $languageRepository;
$this->maritalStatusRepository = $maritalStatusRepository;
$this->translatableStringHelper = $translatableStringHelper;
$this->translator = $translator;
$this->userRepository = $userRepository;
public function __construct(private ExportAddressHelper $addressHelper, private CenterRepositoryInterface $centerRepository, private CivilityRepositoryInterface $civilityRepository, private CountryRepository $countryRepository, private LanguageRepositoryInterface $languageRepository, private MaritalStatusRepositoryInterface $maritalStatusRepository, private TranslatableStringHelper $translatableStringHelper, private TranslatorInterface $translator, private UserRepositoryInterface $userRepository)
{
}
/**
@@ -237,7 +201,7 @@ class ListPersonHelper
public function getLabels($key, array $values, $data): callable
{
if (substr($key, 0, strlen('address_fields')) === 'address_fields') {
if (str_starts_with($key, 'address_fields')) {
return $this->addressHelper->getLabel($key, $values, $data, 'address_fields');
}