Passed
Push — master ( 23dae9...6563ef )
by Andrés
01:14
created

CachePoolClearTask::getName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
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\Symfony;
12
13
use Mage\Task\Exception\ErrorException;
14
use Symfony\Component\Process\Process;
15
16
/**
17
 * Symfony Task - Cache Pool Clear
18
 *
19
 * @author Andrés Montañez <[email protected]>
20
 */
21
class CachePoolClearTask extends AbstractSymfonyTask
22
{
23
    public function getName()
24
    {
25
        return 'symfony/cache-pool-clear';
26
    }
27
28
    public function getDescription()
29
    {
30
        return '[Symfony] Cache Pool Clear';
31
    }
32
33
    public function execute()
34
    {
35
        $options = $this->getOptions();
36
37
        if (!$options['pools']) {
38
            throw new ErrorException('Parameter "pools" is not defined');
39
        }
40
41
        $command = $options['console'] . ' cache:pool:clear ' . $options['pools'] . ' --env=' . $options['env'] . ' ' . $options['flags'];
42
43
        /** @var Process $process */
44
        $process = $this->runtime->runCommand(trim($command));
45
46
        return $process->isSuccessful();
47
    }
48
49
    protected function getSymfonyOptions()
50
    {
51
        return ['pools' => null];
52
    }
53
}
54