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 | /** |
||
6 | * Composer Require |
||
7 | * |
||
8 | * ``` php |
||
9 | * <?php |
||
10 | * // simple execution |
||
11 | * $this->taskComposerRequire()->dependency('foo/bar', '^.2.4.8')->run(); |
||
12 | * ?> |
||
13 | * ``` |
||
14 | */ |
||
15 | class RequireDependency extends Base |
||
16 | { |
||
17 | /** |
||
18 | * {@inheritdoc} |
||
19 | */ |
||
20 | protected $action = 'require'; |
||
21 | |||
22 | /** |
||
23 | * 'require' is a keyword, so it cannot be a method name. |
||
24 | * |
||
25 | * @param string $project |
||
26 | * @param null|string $version |
||
27 | * |
||
28 | * @return $this |
||
29 | */ |
||
30 | public function dependency($project, $version = null) |
||
31 | { |
||
32 | $project = (array)$project; |
||
33 | |||
34 | if (isset($version)) { |
||
35 | $project = array_map( |
||
36 | function ($item) use ($version) { |
||
37 | return "$item:$version"; |
||
38 | }, |
||
39 | $project |
||
40 | ); |
||
41 | } |
||
42 | $this->args($project); |
||
43 | return $this; |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * adds `no-suggest` option to composer |
||
48 | * |
||
49 | * @param bool $noSuggest |
||
50 | * |
||
51 | * @return $this |
||
52 | */ |
||
53 | public function noSuggest($noSuggest = true) |
||
0 ignored issues
–
show
|
|||
54 | { |
||
55 | $this->option('--no-suggest'); |
||
56 | return $this; |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * {@inheritdoc} |
||
61 | */ |
||
62 | public function run() |
||
63 | { |
||
64 | $command = $this->getCommand(); |
||
65 | $this->printTaskInfo('Requiring packages: {command}', ['command' => $command]); |
||
66 | return $this->executeCommand($command); |
||
67 | } |
||
68 | } |
||
69 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.