@@ -18,29 +18,21 @@ final class PruneRestockNotificationRequestsCommand extends Command
1818
1919 protected static $ defaultDescription = 'Remove restock notification requests older than the configured threshold ' ;
2020
21- private RestockNotificationRequestRepositoryInterface $ restockNotificationRequestRepository ;
22-
23- private int $ pruningThreshold ;
24-
2521 public function __construct (
26- RestockNotificationRequestRepositoryInterface $ restockNotificationRequestRepository ,
27- int $ pruningThreshold ,
22+ private readonly RestockNotificationRequestRepositoryInterface $ restockNotificationRequestRepository ,
23+ private readonly int $ pruningThreshold ,
2824 ) {
2925 parent ::__construct ();
30-
31- $ this ->restockNotificationRequestRepository = $ restockNotificationRequestRepository ;
32- $ this ->pruningThreshold = $ pruningThreshold ;
3326 }
3427
3528 protected function configure (): void
3629 {
3730 $ this
3831 ->addOption (
39- 'threshold-days ' ,
40- ' t ' ,
32+ 'pruning-threshold ' ,
33+ null ,
4134 InputOption::VALUE_REQUIRED ,
4235 'Override the configured threshold (in days) ' ,
43- null ,
4436 )
4537 ;
4638 }
@@ -49,8 +41,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
4941 {
5042 $ io = new SymfonyStyle ($ input , $ output );
5143
52- $ thresholdDays = (int ) ($ input ->getOption ('threshold-days ' ) ?? $ this ->pruningThreshold );
53- $ date = new DateTimeImmutable (sprintf ('-%d days ' , $ thresholdDays ));
44+ $ pruningThreshold = (int ) ($ input ->getOption ('pruning-threshold ' ) ?? $ this ->pruningThreshold );
45+ $ date = new DateTimeImmutable (sprintf ('-%d days ' , $ pruningThreshold ));
5446
5547 $ count = $ this ->restockNotificationRequestRepository ->removeOlderThan ($ date );
5648
0 commit comments