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

DeployTestBranchCommand   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 71.43%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 4
dl 0
loc 40
ccs 10
cts 14
cp 0.7143
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A configure() 0 6 1
A execute() 0 8 1
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