Completed
Push — master ( deb1d5...3324ab )
by Pablo
04:13
created

src/PhpGitHooks/Infrastructure/Hook/PreCommit.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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\PreCommitToolCommand;
9
use PhpGitHooks\Module\Git\Contract\CommandHandler\PreCommitToolCommandHandler;
10
use Symfony\Component\Console\Application;
11
use Symfony\Component\Console\Input\InputInterface;
12
use Symfony\Component\Console\Output\OutputInterface;
13
14
/**
15
 * Class PreCommit.
16
 *
17
 * @codingStandardsIgnoreFile
18
 */
19 View Code Duplication
class PreCommit extends Application
0 ignored issues
show
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
20
{
21
    /**
22
     * @var AppKernel
23
     */
24
    private $container;
25
26
    /**
27
     * PreCommit constructor.
28
     */
29
    public function __construct()
30
    {
31
        $appKernel = new AppKernel('dev', true);
32
        $appKernel->boot();
33
        $this->container = $appKernel->getContainer();
34
        parent::__construct('pre-commit');
35
    }
36
37
    public function doRun(InputInterface $input, OutputInterface $output)
38
    {
39
        /**
40
         * @var PreCommitToolCommandHandler
41
         */
42
        $command = $this->container->get('bruli.command.bus');
43
        $command->handle(new PreCommitToolCommand());
44
    }
45
}
46