Passed
Push — master ( fe2fa4...997733 )
by Martin
14:37
created

GitInit::findComposer()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 9
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace Scriptura\QuickStart\Tasks;
5
6
use Scriptura\QuickStart\CommandRunner;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
class GitInit
11
{
12
    public function __construct()
13
    {
14
    }
15
16
    public function __invoke(string $name, InputInterface $input, OutputInterface $output)
17
    {
18
        $output->writeln('<info># Initialize git repository...</info>');
19
20
        $directory = getcwd() . '/' . $name;
21
22
        $commands = [
23
            'git init',
24
        ];
25
26
        $runner = new CommandRunner($output, $directory);
27
        $isSuccessful = $runner->run($commands);
28
29
        if ($isSuccessful) {
30
            $output->writeln('<comment>Git repository initialized.</comment>');
31
        }
32
    }
33
}
34