Passed
Branch master (3fb2a1)
by Andrés
02:45
created

DumpAutoloadTask::getName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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