AddToGitService::call()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0
cc 3
nc 3
nop 0
crap 12
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
    {
12
        return $this->shouldPerformService() ? 'Changes added to git' : 'Changes were not added to git';
13
    }
14
15
    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...
16
    {
17
        return $this->command->option('git');
18
    }
19
20
    public function call()
21
    {
22
        if ($this->shouldPerformService()) {
23
            foreach ($this->command->filesToBeOpened as $file) {
24
                exec('git add '.$file->getPathname());
25
            }
26
        }
27
    }
28
}
29