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

DumpAutoloadTask::getComposerOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
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
15
/**
16
 * Composer Task - Generate Autoload
17
 *
18
 * @author Andrés Montañez <[email protected]>
19
 */
20
class DumpAutoloadTask extends AbstractComposerTask
21
{
22 38
    public function getName()
23
    {
24 38
        return 'composer/dump-autoload';
25
    }
26
27 20
    public function getDescription()
28
    {
29 20
        return '[Composer] Dump Autoload';
30
    }
31
32 19
    public function execute()
33
    {
34 19
        $options = $this->getOptions();
35 19
        $cmd = sprintf('%s dump-autoload %s', $options['path'], $options['flags']);
36
37
        /** @var Process $process */
38 19
        $process = $this->runtime->runCommand(trim($cmd));
39
40 19
        return $process->isSuccessful();
41
    }
42
43 19
    protected function getComposerOptions()
44
    {
45 19
        return ['flags' => '--optimize'];
46
    }
47
}
48