Passed
Pull Request — master (#36)
by Cristian
01:57
created

AddToGitService   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 2
dl 0
loc 21
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getConsoleOutput() 0 3 2
A shouldPerformService() 0 4 1
A call() 0 8 3
1
<?php
2
3
namespace Webfactor\Laravel\Generators\Services;
4
5
use Webfactor\Laravel\Generators\Contracts\ServiceAbstract;
6
use Webfactor\Laravel\Generators\Contracts\ServiceInterface;
7
8
class AddToGitService extends ServiceAbstract implements ServiceInterface
9
{
10
    public function getConsoleOutput() {
11
        return $this->shouldPerformService() ? 'Changes added to git' : 'Changes were not added to git';
12
    }
13
14
    public function shouldPerformService()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
15
    {
16
    	return $this->command->option('git');
17
    }
18
19
    public function call()
20
    {
21
        if ($this->shouldPerformService()) {
22
            foreach ($this->command->filesToBeOpened as $file) {
23
                exec('git add '.$file->getPathname());
24
            }
25
        }
26
    }
27
28
}
29