Completed
Push — master ( 613187...0057b2 )
by Marek
06:22
created

DeployTestBranchCommand::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1.125

Importance

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