|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace N98\Magento\Command\System\Store\Config; |
|
4
|
|
|
|
|
5
|
|
|
use N98\Magento\Command\AbstractMagentoCommand; |
|
6
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
|
7
|
|
|
use Symfony\Component\Console\Input\InputOption; |
|
8
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
9
|
|
|
use N98\Util\Console\Helper\Table\Renderer\RendererFactory; |
|
10
|
|
|
|
|
11
|
|
|
class BaseUrlListCommand extends AbstractMagentoCommand |
|
12
|
|
|
{ |
|
13
|
|
|
/** |
|
14
|
|
|
* @var \Magento\Framework\Store\StoreManagerInterface |
|
15
|
|
|
*/ |
|
16
|
|
|
protected $storeManager; |
|
17
|
|
|
|
|
18
|
|
|
protected function configure() |
|
19
|
|
|
{ |
|
20
|
|
|
$this |
|
21
|
|
|
->setName('sys:store:config:base-url:list') |
|
22
|
|
|
->setDescription('Lists all base urls') |
|
23
|
|
|
->addOption( |
|
24
|
|
|
'format', |
|
25
|
|
|
null, |
|
26
|
|
|
InputOption::VALUE_OPTIONAL, |
|
27
|
|
|
'Output Format. One of [' . implode(',', RendererFactory::getFormats()) . ']' |
|
28
|
|
|
) |
|
29
|
|
|
; |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @param \Magento\Store\Model\StoreManagerInterface $storeManager |
|
34
|
|
|
*/ |
|
35
|
|
|
public function inject(\Magento\Store\Model\StoreManagerInterface $storeManager) |
|
36
|
|
|
{ |
|
37
|
|
|
$this->storeManager = $storeManager; |
|
|
|
|
|
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* @param InputInterface $input |
|
42
|
|
|
* @param OutputInterface $output |
|
43
|
|
|
* @return void |
|
44
|
|
|
*/ |
|
45
|
|
|
protected function execute(InputInterface $input, OutputInterface $output) |
|
46
|
|
|
{ |
|
47
|
|
|
$this->detectMagento($output, true); |
|
48
|
|
|
|
|
49
|
|
|
if (!$input->getOption('format')) { |
|
50
|
|
|
$this->writeSection($output, 'Magento Stores - Base URLs'); |
|
51
|
|
|
} |
|
52
|
|
|
$this->initMagento(); |
|
53
|
|
|
|
|
54
|
|
|
|
|
55
|
|
|
foreach ($this->storeManager->getStores() as $store) { |
|
56
|
|
|
$table[$store->getId()] = array( |
|
|
|
|
|
|
57
|
|
|
$store->getId(), |
|
58
|
|
|
$store->getCode(), |
|
59
|
|
|
$store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_WEB), |
|
60
|
|
|
$store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_WEB, true) |
|
61
|
|
|
); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
ksort($table); |
|
65
|
|
|
$this->getHelper('table') |
|
66
|
|
|
->setHeaders(array('id', 'code', 'unsecure_baseurl', 'secure_baseurl')) |
|
67
|
|
|
->renderByFormat($output, $table, $input->getOption('format')); |
|
68
|
|
|
} |
|
69
|
|
|
} |
|
70
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..