Failed Conditions
Push — develop ( 17c62d...454191 )
by Maxime
22:00 queued 02:09
created

src/Rocketeer/Tasks/Plugins/Updater.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
/*
4
 * This file is part of Rocketeer
5
 *
6
 * (c) Maxime Fabre <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 */
12
13
namespace Rocketeer\Tasks\Plugins;
14
15
use Rocketeer\Tasks\AbstractTask;
16
17
/**
18
 * Updates one or more plugins.
19
 */
20
class Updater extends AbstractTask
21
{
22
    /**
23
     * The console command description.
24
     *
25
     * @var string
26
     */
27
    protected $description = 'Updates one or more plugins';
28
29
    /**
30
     * Whether to run the commands locally
31
     * or on the server.
32
     *
33
     * @var bool
34
     */
35
    protected $local = true;
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function execute()
41
    {
42
        // Get package and destination folder
43
        $package = $this->command->argument('package');
44
45
        $arguments = $package ? [$package] : null;
46
        $options = ['--working-dir' => $this->paths->getRocketeerPath()];
47
        $env = ['COMPOSER_DISCARD_CHANGES' => 1];
48
49
        $command = $this->composer()->update($arguments, $options, $env);
0 ignored issues
show
Documentation Bug introduced by Maxime Fabre
The method composer does not exist on object<Rocketeer\Tasks\Plugins\Updater>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
50
        $this->run($this->shellCommand($command));
51
    }
52
}
53