Test Failed
Pull Request — master (#448)
by
unknown
05:18
created

UpdateTask::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 0
cts 7
cp 0
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
/*
3
 * This file is part of the Magallanes package.
4
 *
5
 * (c) Andrés Montañez <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Mage\Task\BuiltIn\Git;
12
13
use Symfony\Component\Process\Process;
14
use Mage\Task\AbstractTask;
15
16
/**
17
 * Git Task - Pull
18
 *
19
 * @author Andrés Montañez <[email protected]>
20
 */
21
class UpdateTask extends AbstractTask
22
{
23
    public function getName()
24
    {
25
        return 'git/update';
26
    }
27
28
    public function getDescription()
29
    {
30
        return '[Git] Update';
31
    }
32
33
    public function execute()
34
    {
35
        $options = $this->getOptions();
36
        $command = $options['path'] . ' pull';
37
38
        /** @var Process $process */
39
        $process = $this->runtime->runLocalCommand($command);
40
41
        return $process->isSuccessful();
42
    }
43
44 View Code Duplication
    protected function getOptions()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in 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...
45
    {
46
        $branch = $this->runtime->getEnvOption('branch', 'master');
47
        $options = array_merge(
48
            ['path' => 'git', 'branch' => $branch],
49
            $this->options
50
        );
51
52
        return $options;
53
    }
54
}
55