DirectoryPathQuestion   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 3
dl 0
loc 18
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 10 4
1
<?php
2
namespace Samurai\Project\Question;
3
4
use Samurai\Task\ITask;
5
use Symfony\Component\Console\Input\InputInterface;
6
use Symfony\Component\Console\Output\OutputInterface;
7
8
/**
9
 * Class BootstrapQuestion
10
 * @package Samurai\Project\Question
11
 * @author Raphaël Lefebvre <[email protected]>
12
 */
13
class DirectoryPathQuestion extends Question
14
{
15
    /**
16
     * @param InputInterface $input
17
     * @param OutputInterface $output
18
     * @return int
19
     */
20 5
    public function execute(InputInterface $input, OutputInterface $output)
21
    {
22 5
        $optionValue = $input->getOption('dir');
23 5
        if($optionValue){
24 2
            $this->getProject()->setDirectoryPath(getcwd() . DIRECTORY_SEPARATOR . $optionValue);
25 5
        }elseif($this->getProject()->getName()){
26 2
            $this->getProject()->setDirectoryPath(getcwd() . DIRECTORY_SEPARATOR . $this->getProject()->getName());
27 2
        }
28 5
        return $this->getProject()->getDirectoryPath() ? ITask::NO_ERROR_CODE : ITask::BLOCKING_ERROR_CODE;
29
    }
30
}
31