From 0fae79226d6819cae4c2711223a1a1dbf90a06e7 Mon Sep 17 00:00:00 2001 From: Holger Veltrup Date: Mon, 25 Mar 2024 14:42:58 +0100 Subject: [PATCH] refactor: use named arguments --- src/Console/Command/Io/IndexerProgressBar.php | 18 +++++----- src/Dto/Indexer/IndexerStatus.php | 18 +++++----- .../BackgroundIndexerProgressState.php | 36 +++++++++---------- 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/Console/Command/Io/IndexerProgressBar.php b/src/Console/Command/Io/IndexerProgressBar.php index 9908627..7ad097c 100644 --- a/src/Console/Command/Io/IndexerProgressBar.php +++ b/src/Console/Command/Io/IndexerProgressBar.php @@ -33,15 +33,15 @@ public function start(int $total): void $this->progressBar = new ProgressBar($this->output, $total); $this->formatProgressBar('green'); $this->status = new IndexerStatus( - IndexerStatusState::RUNNING, - new DateTime(), - null, - $total, - 0, - 0, - new DateTime(), - 0, - 0 + state: IndexerStatusState::RUNNING, + startTime: new DateTime(), + endTime: null, + total: $total, + processed: 0, + skipped: 0, + lastUpdate: new DateTime(), + updated: 0, + errors: 0 ); } diff --git a/src/Dto/Indexer/IndexerStatus.php b/src/Dto/Indexer/IndexerStatus.php index bba6d45..629b19a 100644 --- a/src/Dto/Indexer/IndexerStatus.php +++ b/src/Dto/Indexer/IndexerStatus.php @@ -39,15 +39,15 @@ public static function empty(): IndexerStatus { $now = new DateTime(); return new IndexerStatus( - IndexerStatusState::UNKNOWN, - $now, - $now, - 0, - 0, - 0, - $now, - 0, - 0 + state: IndexerStatusState::UNKNOWN, + startTime: $now, + endTime: $now, + total:0, + processed: 0, + skipped: 0, + lastUpdate: $now, + updated: 0, + errors: 0 ); } diff --git a/src/Service/Indexer/BackgroundIndexerProgressState.php b/src/Service/Indexer/BackgroundIndexerProgressState.php index 9e9fa53..a6ebff4 100644 --- a/src/Service/Indexer/BackgroundIndexerProgressState.php +++ b/src/Service/Indexer/BackgroundIndexerProgressState.php @@ -29,15 +29,15 @@ public function __construct( public function start(int $total): void { $this->status = new IndexerStatus( - IndexerStatusState::RUNNING, - new DateTime(), - null, - $total, - 0, - 0, - new DateTime(), - 0, - 0 + state:IndexerStatusState::RUNNING, + startTime: new DateTime(), + endTime: null, + total: $total, + processed: 0, + skipped: 0, + lastUpdate: new DateTime(), + updated: 0, + errors: 0 ); } @@ -49,15 +49,15 @@ public function startUpdate(int $total): void $this->isUpdate = true; $storedStatus = $this->statusStore->load($this->index); $this->status = new IndexerStatus( - IndexerStatusState::RUNNING, - $storedStatus->startTime, - $storedStatus->endTime, - $storedStatus->total + $total, - $storedStatus->processed, - $storedStatus->skipped, - new DateTime(), - $storedStatus->updated, - $storedStatus->errors, + state: IndexerStatusState::RUNNING, + startTime: $storedStatus->startTime, + endTime: $storedStatus->endTime, + total: $storedStatus->total + $total, + processed: $storedStatus->processed, + skipped: $storedStatus->skipped, + lastUpdate: new DateTime(), + updated: $storedStatus->updated, + errors: $storedStatus->errors, ); }