Completed
Push — master ( d3a073...5737c8 )
by Greg
02:21
created

src/Task/Gulp/Base.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Robo\Task\Gulp;
4
5
use Robo\Task\BaseTask;
6
use Robo\Exception\TaskException;
7
use Robo\Common\ProcessUtils;
8
9
abstract class Base extends BaseTask
10
{
11
    use \Robo\Common\ExecOneCommand;
12
13
    /**
14
     * @var string
15
     */
16
    protected $command = '';
17
18
    /**
19
     * @var array
20
     */
21
    protected $opts = [];
22
23
    /**
24
     * @var string
25
     */
26
    protected $task = '';
27
28
    /**
29
     * adds `silent` option to gulp
30
     *
31
     * @return $this
32
     */
33
    public function silent()
34
    {
35
        $this->option('silent');
36
        return $this;
37
    }
38
39
    /**
40
     * adds `--no-color` option to gulp
41
     *
42
     * @return $this
43
     */
44
    public function noColor()
45
    {
46
        $this->option('no-color');
47
        return $this;
48
    }
49
50
    /**
51
     * adds `--color` option to gulp
52
     *
53
     * @return $this
54
     */
55
    public function color()
56
    {
57
        $this->option('color');
58
        return $this;
59
    }
60
61
    /**
62
     * adds `--tasks-simple` option to gulp
63
     *
64
     * @return $this
65
     */
66
    public function simple()
67
    {
68
        $this->option('tasks-simple');
69
        return $this;
70
    }
71
72
    /**
73
     * @param string $task
74
     * @param null|string $pathToGulp
75
     *
76
     * @throws \Robo\Exception\TaskException
77
     */
78 View Code Duplication
    public function __construct($task, $pathToGulp = null)
0 ignored issues
show
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...
79
    {
80
        $this->task = $task;
81
        $this->command = $pathToGulp;
82
        if (!$this->command) {
83
            $this->command = $this->findExecutable('gulp');
84
        }
85
        if (!$this->command) {
86
            throw new TaskException(__CLASS__, "Gulp executable not found.");
87
        }
88
    }
89
90
    /**
91
     * @return string
92
     */
93
    public function getCommand()
94
    {
95
        return "{$this->command} " . ProcessUtils::escapeArgument($this->task) . "{$this->arguments}";
96
    }
97
}
98