Passed
Push — master ( d95e49...7c87fb )
by Andrés
39s
created

src/Task/BuiltIn/Composer/DumpAutoloadTask.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
 * This file is part of the Magallanes package.
4
 *
5
 * (c) Andrés Montañez <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Mage\Task\BuiltIn\Composer;
12
13
use Symfony\Component\Process\Process;
14
use Mage\Task\AbstractTask;
15
16
/**
17
 * Composer Task - Generate Autoload
18
 *
19
 * @author Andrés Montañez <[email protected]>
20
 */
21
class DumpAutoloadTask extends AbstractTask
22
{
23 31
    public function getName()
24
    {
25 31
        return 'composer/dump-autoload';
26
    }
27
28 17
    public function getDescription()
29
    {
30 17
        return '[Composer] Dump Autoload';
31
    }
32
33 16
    public function execute()
34
    {
35 16
        $options = $this->getOptions();
36 16
        $cmd = sprintf('%s dump-autoload %s', $options['path'], $options['flags']);
37
38
        /** @var Process $process */
39 16
        $process = $this->runtime->runCommand(trim($cmd));
40
41 16
        return $process->isSuccessful();
42
    }
43
44 16 View Code Duplication
    protected function getOptions()
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...
45
    {
46 16
        $options = array_merge(
47 16
            ['path' => 'composer', 'flags' => '--optimize'],
48 16
            $this->runtime->getMergedOption('composer'),
49 16
            $this->options
50 16
        );
51
52 16
        return $options;
53
    }
54
}
55