Skip to content

Commit ff0aa7b

Browse files
committed
Move magentoVersion dependency and code to ShowStatus process instead of Status command
1 parent 40bb41a commit ff0aa7b

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

src/Command/Process/ShowStatus.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace Magento\CloudPatches\Command\Process;
99

1010
use Magento\CloudPatches\Command\Process\Action\ReviewAppliedAction;
11+
use Magento\CloudPatches\Composer\MagentoVersion;
1112
use Magento\CloudPatches\Console\QuestionFactory;
1213
use Magento\CloudPatches\Patch\Data\AggregatedPatch;
1314
use Magento\CloudPatches\Patch\Data\AggregatedPatchInterface;
@@ -45,6 +46,11 @@ class ShowStatus implements ProcessInterface
4546
*/
4647
private $localPool;
4748

49+
/**
50+
* @var MagentoVersion
51+
*/
52+
private $magentoVersion;
53+
4854
/**
4955
* @var StatusPool
5056
*/
@@ -88,7 +94,8 @@ public function __construct(
8894
ReviewAppliedAction $reviewAppliedAction,
8995
Renderer $renderer,
9096
QuestionHelper $questionHelper,
91-
QuestionFactory $questionFactory
97+
QuestionFactory $questionFactory,
98+
MagentoVersion $magentoVersion
9299
) {
93100
$this->aggregator = $aggregator;
94101
$this->optionalPool = $optionalPool;
@@ -98,6 +105,7 @@ public function __construct(
98105
$this->renderer = $renderer;
99106
$this->questionHelper = $questionHelper;
100107
$this->questionFactory = $questionFactory;
108+
$this->magentoVersion = $magentoVersion;
101109
}
102110

103111
/**
@@ -134,6 +142,10 @@ public function run(InputInterface $input, OutputInterface $output)
134142
} else {
135143
$this->renderer->printTable($output, array_values($patches));
136144
}
145+
146+
if (!$isJsonFormat) {
147+
$output->writeln('<info>' . $this->magentoVersion->get() . '</info>');
148+
}
137149
}
138150

139151
/**

src/Command/Status.php

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
use Magento\CloudPatches\App\RuntimeException;
1111
use Magento\CloudPatches\Command\Process\ShowStatus;
12-
use Magento\CloudPatches\Composer\MagentoVersion;
1312
use Psr\Log\LoggerInterface;
1413
use Symfony\Component\Console\Input\InputArgument;
1514
use Symfony\Component\Console\Input\InputInterface;
@@ -33,24 +32,16 @@ class Status extends AbstractCommand
3332
*/
3433
private $logger;
3534

36-
/**
37-
* @var MagentoVersion
38-
*/
39-
private $magentoVersion;
40-
4135
/**
4236
* @param ShowStatus $showStatus
4337
* @param LoggerInterface $logger
44-
* @param MagentoVersion $magentoVersion
4538
*/
4639
public function __construct(
4740
ShowStatus $showStatus,
48-
LoggerInterface $logger,
49-
MagentoVersion $magentoVersion
41+
LoggerInterface $logger
5042
) {
5143
$this->showStatus = $showStatus;
5244
$this->logger = $logger;
53-
$this->magentoVersion = $magentoVersion;
5445

5546
parent::__construct(self::NAME);
5647
}
@@ -74,9 +65,6 @@ public function execute(InputInterface $input, OutputInterface $output)
7465
{
7566
try {
7667
$this->showStatus->run($input, $output);
77-
if ($input->getOption('format') !== 'json') {
78-
$output->writeln('<info>' . $this->magentoVersion->get() . '</info>');
79-
}
8068
} catch (RuntimeException $e) {
8169
$output->writeln('<error>' . $e->getMessage() . '</error>');
8270
$this->logger->error($e->getMessage());

0 commit comments

Comments
 (0)