diff --git a/Model/Console/BlockListCommand.php b/Model/Console/BlockListCommand.php index ba6d18ee4af347703e261460829fdfa9d2dc8224..af035b9f3af15cc012b3ea1d9f79970469392533 100644 --- a/Model/Console/BlockListCommand.php +++ b/Model/Console/BlockListCommand.php @@ -97,11 +97,13 @@ class BlockListCommand extends Command public function execute(InputInterface $input, OutputInterface $output): int { if ($input->getOption(self::PARAM_CHANGED_ONLY)) { - $changedBlockEntries = $this->getChangedCmsBlockEntries(); - $this->changedBlockDataProvider->execute($output, $changedBlockEntries); + $changedBlockDto = $this->getChangedCmsBlockEntries(); + $tableData = $this->changedBlockDataProvider->execute($output, $changedBlockDto); + $tableData->render($output); } else { $blockEntries = $this->getAllBlockEntries->get(); - $this->blockDataProvider->execute($output, $blockEntries); + $tableData = $this->blockDataProvider->execute($output, $blockEntries); + $tableData->render($output); } return Cli::RETURN_SUCCESS; diff --git a/ViewModel/BlockDataProvider.php b/ViewModel/BlockDataProvider.php index adb71285e79e04548d331089c8e35cde5728c425..7b18dc2000f483b143d52a3cc34b9de7b8e2f1e1 100644 --- a/ViewModel/BlockDataProvider.php +++ b/ViewModel/BlockDataProvider.php @@ -30,6 +30,9 @@ class BlockDataProvider */ private GetDbBlockIds $getDbBlockIds; + /** + * @param GetDbBlockIds $getDbBlockIds + */ public function __construct( GetDbBlockIds $getDbBlockIds ) { @@ -37,13 +40,13 @@ class BlockDataProvider } /** - * Delivery table data + * Get table data * @param OutputInterface $output * @param BlockEntry[] $blockEntries - * @return void + * @return Table * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function execute(OutputInterface $output, array $blockEntries): void + public function execute(OutputInterface $output, array $blockEntries): Table { $table = new Table($output); $table->setHeaders(['Key', 'Identifier', 'Stores', 'Maintained', 'Active', 'Title', 'Block ID(s) in DB']); @@ -61,6 +64,6 @@ class BlockDataProvider ]; $table->addRow($rowData); } - $table->render($output); + return $table; } } diff --git a/ViewModel/ChangedBlockDataProvider.php b/ViewModel/ChangedBlockDataProvider.php index ddbf723224fa6bb16cd485bac3e3ec0182767b4d..dae7c947d88a14bc189f7c8ee57a8bb52e7f1296 100644 --- a/ViewModel/ChangedBlockDataProvider.php +++ b/ViewModel/ChangedBlockDataProvider.php @@ -30,6 +30,9 @@ class ChangedBlockDataProvider */ private GetDbBlockIds $getDbBlockIds; + /** + * @param GetDbBlockIds $getDbBlockIds + */ public function __construct( GetDbBlockIds $getDbBlockIds ) { @@ -37,17 +40,17 @@ class ChangedBlockDataProvider } /** - * Delivery table data + * Get table data * @param OutputInterface $output - * @param CmsBlockDto[] $changedBlockEntries - * @return void + * @param CmsBlockDto[] $changedBlockDtos + * @return Table * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function execute(OutputInterface $output, array $changedBlockEntries): void + public function execute(OutputInterface $output, array $changedBlockDtos): Table { $table = new Table($output); $table->setHeaders(['Key', 'Identifier', 'Stores', 'Maintained', 'Active', 'Title', 'Block ID(s) in DB']); - foreach ($changedBlockEntries as $block) { + foreach ($changedBlockDtos as $block) { $storeCodes = $block->getStoreCodes(); $dbBlockIds = $this->getDbBlockIds->execute($block->getKey()); $rowData = [ @@ -61,6 +64,6 @@ class ChangedBlockDataProvider ]; $table->addRow($rowData); } - $table->render($output); + return $table; } }