Completed
Push — 57-formatter-per-extension ( 73b3c8 )
by Nicolas
40:17 queued 36:16
created

VCS::execute()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 23
Code Lines 12

Duplication

Lines 10
Ratio 43.48 %

Importance

Changes 9
Bugs 1 Features 2
Metric Value
c 9
b 1
f 2
dl 10
loc 23
rs 9.0857
cc 3
eloc 12
nc 3
nop 2
1
<?php
2
3
namespace Karma\Command;
4
5
use Symfony\Component\Console\Input\InputInterface;
6
use Symfony\Component\Console\Output\OutputInterface;
7
use Karma\Command;
8
use Symfony\Component\Console\Input\InputArgument;
9
10
class VCS extends Command
11
{
12
    protected function configure()
13
    {
14
        parent::configure();
15
        
16
        $this
17
            ->setName('vcs')
18
            ->setDescription('')
19
            ->addArgument('sourcePath', InputArgument::OPTIONAL, 'source path')
20
        ;
21
    }
22
    
23
    protected function execute(InputInterface $input, OutputInterface $output)
24
    {
25
        parent::execute($input, $output);
26
        
27
        $this->output->writeln("<info>Looking for vcs operations</info>\n");
28
        
29
        $sourcePath = $input->getArgument('sourcePath');
30 View Code Duplication
        if($sourcePath === null)
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
31
        {
32
            $profile = $this->app['profile'];
33
            if($profile->hasSourcePath() !== true)
34
            {
35
                throw new \RuntimeException('Missing argument sourcePath');
36
            }
37
        
38
            $sourcePath = $profile->getSourcePath();
39
        }
40
        
41
        $this->app['sources.path'] = $sourcePath;
42
        
43
        $vcs = $this->app['vcsHandler']($this->app['vcs']);
44
        $vcs->execute($this->app['sources.path']);
45
    }
46
}