Passed
Push — master ( b34030...56c38f )
by Sebastian
03:50
created

Application::doRun()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
c 0
b 0
f 0
ccs 5
cts 5
cp 1
rs 9.4285
cc 1
eloc 5
nc 1
nop 2
crap 1
1
<?php
2
/**
3
 * This file is part of CaptainHook.
4
 *
5
 * (c) Sebastian Feldmann <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace sebastianfeldmann\CaptainHook\Composer;
11
12
use Composer\IO\IOInterface;
13
use sebastianfeldmann\CaptainHook\Console\Application\ConfigHandler;
14
use sebastianfeldmann\CaptainHook\Console\Command\Configuration;
15
use sebastianfeldmann\CaptainHook\Console\IO\ComposerIO;
16
use Symfony\Component\Console\Input\ArrayInput;
17
use Symfony\Component\Console\Input\InputInterface;
18
use Symfony\Component\Console\Output\OutputInterface;
19
20
/**
21
 * Class Application
22
 *
23
 * @package CaptainHook
24
 * @author  Sebastian Feldmann <[email protected]>
25
 * @link    https://github.com/sebastianfeldmann/captainhook
26
 * @since   Class available since Release 0.9.0
27
 */
28
class Application extends ConfigHandler
29
{
30
    /**
31
     * Composer IO Proxy
32
     *
33
     * @var \sebastianfeldmann\CaptainHook\Console\IO\ComposerIO
34
     */
35
    protected $io;
36
37
    /**
38
     * Set the composer application IO.
39
     *
40
     * @param  \Composer\IO\IOInterface $io
41
     */
42 1
    public function setProxyIO(IOInterface $io)
43
    {
44 1
        $this->io = new ComposerIO($io);
45 1
    }
46
47
    /**
48
     * Execute hook.
49
     *
50
     * @param  \Symfony\Component\Console\Input\InputInterface   $input
51
     * @param  \Symfony\Component\Console\Output\OutputInterface $output
52
     * @return int
53
     */
54 1
    public function doRun(InputInterface $input, OutputInterface $output)
55
    {
56 1
        $input   = new ArrayInput(['--configuration' => $this->getConfigFile()]);
57 1
        $command = new Configuration();
58 1
        $command->setIO($this->io);
59 1
        return $command->run($input, $output);
60
    }
61
}
62