Completed
Branch module_structure (3116d9)
by Pablo
02:56
created

PrePush   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 3
Bugs 0 Features 2
Metric Value
wmc 2
c 3
b 0
f 2
lcom 1
cbo 4
dl 0
loc 36
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A doRun() 0 6 1
1
<?php
2
3
namespace PhpGitHooks\Infrastructure\Hook;
4
5
require_once __DIR__.'/../../../../app/AppKernel.php';
6
7
use AppKernel;
8
use PhpGitHooks\Module\Git\Contract\Command\PrePushToolCommand;
9
use PhpGitHooks\Module\Git\Contract\CommandHandler\PrePushToolCommandHandler;
10
use Symfony\Component\Console\Application;
11
use Symfony\Component\Console\Input\InputInterface;
12
use Symfony\Component\Console\Output\OutputInterface;
13
14
class PrePush extends Application
15
{
16
    /**
17
     * @var AppKernel
18
     */
19
    private $container;
20
    /**
21
     * @var string
22
     */
23
    private $remote;
24
    /**
25
     * @var string
26
     */
27
    private $url;
28
29
    /**
30
     * PrePush constructor.
31
     *
32
     * @param string $remote
33
     * @param string $url
34
     */
35
    public function __construct($remote, $url)
36
    {
37
        $this->container = new AppKernel();
38
        parent::__construct('pre-push');
39
        $this->remote = $remote;
40
        $this->url = $url;
41
    }
42
43
    public function doRun(InputInterface $input, OutputInterface $output)
44
    {
45
        /** @var PrePushToolCommandHandler $command */
46
        $command = $this->container->get('command.bus');
47
        $command->handle(new PrePushToolCommand($this->remote, $this->url));
48
    }
49
}
50