Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / consolidation / robo / src / Task / Composer / RequireDependency.php
1 <?php
2 namespace Robo\Task\Composer;
3
4 /**
5  * Composer Require
6  *
7  * ``` php
8  * <?php
9  * // simple execution
10  * $this->taskComposerRequire()->dependency('foo/bar', '^.2.4.8')->run();
11  * ?>
12  * ```
13  */
14 class RequireDependency extends Base
15 {
16     /**
17      * {@inheritdoc}
18      */
19     protected $action = 'require';
20
21     /**
22      * 'require' is a keyword, so it cannot be a method name.
23      * @return $this
24      */
25     public function dependency($project, $version = null)
26     {
27         $project = (array)$project;
28
29         if (isset($version)) {
30             $project = array_map(
31                 function ($item) use ($version) {
32                     return "$item:$version";
33                 },
34                 $project
35             );
36         }
37         $this->args($project);
38         return $this;
39     }
40
41     /**
42      * {@inheritdoc}
43      */
44     public function run()
45     {
46         $command = $this->getCommand();
47         $this->printTaskInfo('Requiring packages: {command}', ['command' => $command]);
48         return $this->executeCommand($command);
49     }
50 }