Skip to content

Commit

Permalink
UHF-10539: Remove config load away from service constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
hyrsky committed Dec 9, 2024
1 parent fd000b7 commit d54979e
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/RedirectCleaner.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,24 @@
*/
class RedirectCleaner {

/**
* Redirect cleaner configuration.
*/
private array $configuration;

/**
* Constructs a new instance.
*/
public function __construct(
ConfigFactoryInterface $configFactory,
private readonly ConfigFactoryInterface $configFactory,
private readonly EntityTypeManagerInterface $entityTypeManager,
#[Autowire(service: 'logger.channel.helfi_platform_config')]
private readonly LoggerInterface $logger,
) {
$this->configuration = $configFactory->get('helfi_platform_config.redirect_cleaner')->get();
}

/**
* Return TRUE if this feature is enabled.
*/
public function isEnabled(): bool {
return $this->configuration['enable'] ?? FALSE;
return $this->configFactory
->get('helfi_platform_config.redirect_cleaner')
->get('enable') ?? FALSE;
}

/**
Expand Down

0 comments on commit d54979e

Please sign in to comment.