Test Failed
Pull Request — master (#448)
by
unknown
05:18
created

DumpAutoloadTask   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 3
dl 0
loc 28
ccs 0
cts 19
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getComposerOptions() 0 4 1
A getName() 0 4 1
A getDescription() 0 4 1
A execute() 0 10 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
    public function getName()
23
    {
24
        return 'composer/dump-autoload';
25
    }
26
27
    public function getDescription()
28
    {
29
        return '[Composer] Dump Autoload';
30
    }
31
32
    public function execute()
33
    {
34
        $options = $this->getOptions();
35
        $cmd = sprintf('%s dump-autoload %s', $options['path'], $options['flags']);
36
37
        /** @var Process $process */
38
        $process = $this->runtime->runCommand(trim($cmd));
39
40
        return $process->isSuccessful();
41
    }
42
43
    protected function getComposerOptions()
44
    {
45
        return ['flags' => '--optimize'];
46
    }
47
}
48