Passed
Push — master ( 0057b2...3e8fcf )
by Marek
02:11
created

DeployTestBranchCommand::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace AppBuilder\Command;
6
7
use AppBuilder\Application\Configuration\ValueObject\Parameters;
8
use AppBuilder\Event\Application\ApplicationInitializedEvent;
9
use Psr\Log\LoggerInterface;
10
use Symfony\Component\Console\Command\Command;
11
use Symfony\Component\Console\Exception\LogicException;
12
use Symfony\Component\Console\Input\InputInterface;
13
use Symfony\Component\Console\Output\OutputInterface;
14
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
15
16
class DeployTestBranchCommand extends Command
17
{
18
    public const NAME = 'app:watch';
19
20
    /** @var LoggerInterface */
21
    private $logger;
22
23
    /** @var Parameters */
24
    private $applicationParams;
25
26
    /** @var EventDispatcherInterface */
27
    private $dispatcher;
28
29
    /**
30
     * @throws LogicException
31
     */
32 1
    public function __construct(
33
        Parameters $applicationParams,
34
        LoggerInterface $logger,
35
        EventDispatcherInterface $dispatcher
36
    ) {
37 1
        parent::__construct(null);
38 1
        $this->applicationParams = $applicationParams;
39 1
        $this->logger            = $logger;
40 1
        $this->dispatcher        = $dispatcher;
41 1
    }
42
43 1
    protected function configure() : void
44
    {
45
        $this
46 1
            ->setName(static::NAME)
47 1
            ->setDescription('Observe JIRA tickets and create test deploys if required');
48 1
    }
49
50
    protected function execute(InputInterface $input, OutputInterface $output) : void
51
    {
52
        $this->logger->info('Initializing application...');
53
        $this->dispatcher->dispatch(
54
            ApplicationInitializedEvent::NAME,
55
            new ApplicationInitializedEvent()
56
        );
57
    }
58
}
59