Completed
Pull Request — master (#341)
by De Cramer
05:04
created

TestUiCommand::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 3
1
<?php
2
3
namespace eXpansion\Framework\MlComposeBundle\Command;
4
5
use eXpansion\Framework\Core\Plugins\Gui\WindowHelpFactory;
6
use Oliverde8\PageCompose\Service\BlockDefinitions;
7
use Oliverde8\PageCompose\Service\UiComponents;
8
use Symfony\Component\Console\Command\Command;
9
use Symfony\Component\Console\Input\InputArgument;
10
use Symfony\Component\Console\Input\InputInterface;
11
use Symfony\Component\Console\Output\OutputInterface;
12
13
/**
14
 * Class TestUiCommand
15
 *
16
 * @author    de Cramer Oliver<[email protected]>
17
 * @copyright 2018 Oliverde8
18
 * @package eXpansion\Framework\MlComposeBundle\Command
19
 */
20
class TestUiCommand extends Command
21
{
22
    /** @var BlockDefinitions */
23
    protected $blockDefinitions;
24
25
    /** @var WindowHelpFactory */
26
    protected $helpFactory;
27
28
    /** @var UiComponents */
29
    protected $uiComponents;
30
31
    /**
32
     * TestUiCommand constructor.
33
     *
34
     * @param BlockDefinitions $blockDefinitions
35
     * @param UiComponents $uiComponents
36
     */
37
    public function __construct(BlockDefinitions $blockDefinitions, UiComponents $uiComponents, WindowHelpFactory $helpFactory)
38
    {
39
        parent::__construct();
40
41
        $this->blockDefinitions = $blockDefinitions;
42
        $this->uiComponents = $uiComponents;
43
        $this->helpFactory = $helpFactory;
44
    }
45
46
47
    protected function configure()
48
    {
49
        $this->setName('eXpansion:debug:ml-compose')
50
            ->setDescription("Debug expansion ui builder.");
51
52
        $this->addArgument('block', InputArgument::REQUIRED);
53
    }
54
55
    protected function execute(InputInterface $input, OutputInterface $output)
56
    {
57
        foreach ($this->blockDefinitions->getPageBlocks('base.window', []) as $block) {
58
            echo $this->uiComponents->display($block, $this->helpFactory, $this);
59
        }
60
    }
61
}