This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
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\Composer; |
||
4 | |||
5 | use Robo\Contract\CommandInterface; |
||
6 | use Robo\Exception\TaskException; |
||
7 | use Robo\Task\BaseTask; |
||
8 | |||
9 | abstract class Base extends BaseTask implements CommandInterface |
||
10 | { |
||
11 | use \Robo\Common\ExecOneCommand; |
||
12 | |||
13 | /** |
||
14 | * @var string |
||
15 | */ |
||
16 | protected $command = ''; |
||
17 | |||
18 | /** |
||
19 | * @var bool |
||
20 | */ |
||
21 | protected $built = false; |
||
22 | |||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $prefer; |
||
27 | |||
28 | /** |
||
29 | * @var string |
||
30 | */ |
||
31 | protected $dev; |
||
32 | |||
33 | /** |
||
34 | * @var string |
||
35 | */ |
||
36 | protected $ansi; |
||
37 | |||
38 | /** |
||
39 | * @var string |
||
40 | */ |
||
41 | protected $nointeraction; |
||
42 | |||
43 | /** |
||
44 | * Action to use |
||
45 | * |
||
46 | * @var string |
||
47 | */ |
||
48 | protected $action = ''; |
||
49 | |||
50 | /** |
||
51 | * @param null|string $pathToComposer |
||
52 | * |
||
53 | * @throws \Robo\Exception\TaskException |
||
54 | */ |
||
55 | View Code Duplication | public function __construct($pathToComposer = null) |
|
56 | { |
||
57 | $this->command = $pathToComposer; |
||
58 | if (!$this->command) { |
||
59 | $this->command = $this->findExecutablePhar('composer'); |
||
60 | } |
||
61 | if (!$this->command) { |
||
62 | throw new TaskException(__CLASS__, "Neither local composer.phar nor global composer installation could be found."); |
||
63 | } |
||
64 | } |
||
65 | |||
66 | /** |
||
67 | * adds `prefer-dist` option to composer |
||
68 | * |
||
69 | * @param bool $preferDist |
||
70 | * |
||
71 | * @return $this |
||
72 | */ |
||
73 | public function preferDist($preferDist = true) |
||
74 | { |
||
75 | if (!$preferDist) { |
||
76 | return $this->preferSource(); |
||
77 | } |
||
78 | $this->prefer = '--prefer-dist'; |
||
79 | return $this; |
||
80 | } |
||
81 | |||
82 | /** |
||
83 | * adds `prefer-source` option to composer |
||
84 | * |
||
85 | * @return $this |
||
86 | */ |
||
87 | public function preferSource() |
||
88 | { |
||
89 | $this->prefer = '--prefer-source'; |
||
90 | return $this; |
||
91 | } |
||
92 | |||
93 | /** |
||
94 | * adds `dev` option to composer |
||
95 | * |
||
96 | * @param bool $dev |
||
97 | * |
||
98 | * @return $this |
||
99 | */ |
||
100 | public function dev($dev = true) |
||
101 | { |
||
102 | if (!$dev) { |
||
103 | return $this->noDev(); |
||
104 | } |
||
105 | $this->dev = '--dev'; |
||
106 | return $this; |
||
107 | } |
||
108 | |||
109 | /** |
||
110 | * adds `no-dev` option to composer |
||
111 | * |
||
112 | * @return $this |
||
113 | */ |
||
114 | public function noDev() |
||
115 | { |
||
116 | $this->dev = '--no-dev'; |
||
117 | return $this; |
||
118 | } |
||
119 | |||
120 | /** |
||
121 | * adds `ansi` option to composer |
||
122 | * |
||
123 | * @param bool $ansi |
||
124 | * |
||
125 | * @return $this |
||
126 | */ |
||
127 | public function ansi($ansi = true) |
||
128 | { |
||
129 | if (!$ansi) { |
||
130 | return $this->noAnsi(); |
||
131 | } |
||
132 | $this->ansi = '--ansi'; |
||
133 | return $this; |
||
134 | } |
||
135 | |||
136 | /** |
||
137 | * adds `no-ansi` option to composer |
||
138 | * |
||
139 | * @return $this |
||
140 | */ |
||
141 | public function noAnsi() |
||
142 | { |
||
143 | $this->ansi = '--no-ansi'; |
||
144 | return $this; |
||
145 | } |
||
146 | |||
147 | /** |
||
148 | * @param bool $interaction |
||
149 | * |
||
150 | * @return $this |
||
151 | */ |
||
152 | public function interaction($interaction = true) |
||
153 | { |
||
154 | if (!$interaction) { |
||
155 | return $this->noInteraction(); |
||
156 | } |
||
157 | return $this; |
||
158 | } |
||
159 | |||
160 | /** |
||
161 | * adds `no-interaction` option to composer |
||
162 | * |
||
163 | * @return $this |
||
164 | */ |
||
165 | public function noInteraction() |
||
166 | { |
||
167 | $this->nointeraction = '--no-interaction'; |
||
168 | return $this; |
||
169 | } |
||
170 | |||
171 | /** |
||
172 | * adds `optimize-autoloader` option to composer |
||
173 | * |
||
174 | * @param bool $optimize |
||
175 | * |
||
176 | * @return $this |
||
177 | */ |
||
178 | public function optimizeAutoloader($optimize = true) |
||
179 | { |
||
180 | if ($optimize) { |
||
181 | $this->option('--optimize-autoloader'); |
||
182 | } |
||
183 | return $this; |
||
184 | } |
||
185 | |||
186 | /** |
||
187 | * adds `ignore-platform-reqs` option to composer |
||
188 | * |
||
189 | * @param bool $ignore |
||
190 | * |
||
191 | * @return $this |
||
192 | */ |
||
193 | public function ignorePlatformRequirements($ignore = true) |
||
0 ignored issues
–
show
|
|||
194 | { |
||
195 | $this->option('--ignore-platform-reqs'); |
||
196 | return $this; |
||
197 | } |
||
198 | |||
199 | /** |
||
200 | * disable plugins |
||
201 | * |
||
202 | * @param bool $disable |
||
203 | * |
||
204 | * @return $this |
||
205 | */ |
||
206 | public function disablePlugins($disable = true) |
||
207 | { |
||
208 | if ($disable) { |
||
209 | $this->option('--no-plugins'); |
||
210 | } |
||
211 | return $this; |
||
212 | } |
||
213 | |||
214 | /** |
||
215 | * skip scripts |
||
216 | * |
||
217 | * @param bool $disable |
||
218 | * |
||
219 | * @return $this |
||
220 | */ |
||
221 | public function noScripts($disable = true) |
||
222 | { |
||
223 | if ($disable) { |
||
224 | $this->option('--no-scripts'); |
||
225 | } |
||
226 | return $this; |
||
227 | } |
||
228 | |||
229 | /** |
||
230 | * adds `--working-dir $dir` option to composer |
||
231 | * |
||
232 | * @param string $dir |
||
233 | * |
||
234 | * @return $this |
||
235 | */ |
||
236 | public function workingDir($dir) |
||
237 | { |
||
238 | $this->option("--working-dir", $dir); |
||
239 | return $this; |
||
240 | } |
||
241 | |||
242 | /** |
||
243 | * Copy class fields into command options as directed. |
||
244 | */ |
||
245 | public function buildCommand() |
||
246 | { |
||
247 | if (!isset($this->ansi) && $this->getConfig()->get(\Robo\Config\Config::DECORATED)) { |
||
248 | $this->ansi(); |
||
249 | } |
||
250 | if (!isset($this->nointeraction) && !$this->getConfig()->get(\Robo\Config\Config::INTERACTIVE)) { |
||
251 | $this->noInteraction(); |
||
252 | } |
||
253 | $this->option($this->prefer) |
||
254 | ->option($this->dev) |
||
255 | ->option($this->nointeraction) |
||
256 | ->option($this->ansi); |
||
257 | } |
||
258 | |||
259 | /** |
||
260 | * {@inheritdoc} |
||
261 | */ |
||
262 | public function getCommand() |
||
263 | { |
||
264 | if (!$this->built) { |
||
265 | $this->buildCommand(); |
||
266 | $this->built = true; |
||
267 | } |
||
268 | return "{$this->command} {$this->action}{$this->arguments}"; |
||
269 | } |
||
270 | } |
||
271 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.