AssetsInstallTask   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 13
c 0
b 0
f 0
dl 0
loc 31
ccs 15
cts 15
cp 1
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 14 1
A getName() 0 3 1
A getSymfonyOptions() 0 3 1
A getDescription() 0 3 1
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\Symfony;
13
14
use Symfony\Component\Process\Process;
15
16
/**
17
 * Symfony Task - Install Assets
18
 *
19
 * @author Andrés Montañez <[email protected]>
20
 */
21
class AssetsInstallTask extends AbstractSymfonyTask
22
{
23 48
    public function getName(): string
24
    {
25 48
        return 'symfony/assets-install';
26
    }
27
28 20
    public function getDescription(): string
29
    {
30 20
        return '[Symfony] Assets Install';
31
    }
32
33 19
    public function execute(): bool
34
    {
35 19
        $options = $this->getOptions();
36 19
        $command = sprintf(
37
            '%s assets:install %s --env=%s %s',
38 19
            $options['console'],
39 19
            $options['target'],
40 19
            $options['env'],
41 19
            $options['flags']
42
        );
43
44 19
        $process = $this->runtime->runCommand(trim($command));
45
46 19
        return $process->isSuccessful();
47
    }
48
49 19
    protected function getSymfonyOptions(): array
50
    {
51 19
        return ['target' => 'web', 'flags' => '--symlink --relative'];
52
    }
53
}
54