CacheClearDispatcher   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 6
c 2
b 0
f 0
dl 0
loc 22
ccs 0
cts 5
cp 0
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A dispatch() 0 6 1
A canDispatchTaskDefinition() 0 3 1
1
<?php
2
3
namespace Deployee\Plugins\ShopwareTasks\Dispatcher;
4
5
use Deployee\Plugins\Deploy\Definitions\Tasks\TaskDefinitionInterface;
6
use Deployee\Plugins\Deploy\Dispatcher\DispatchResultInterface;
7
use Deployee\Plugins\ShopwareTasks\Definitions\CacheClearDefinition;
8
use Deployee\Plugins\ShopwareTasks\Definitions\ShopwareCommandDefinition;
9
10
class CacheClearDispatcher extends AbstractShopwareDispatcher
11
{
12
    /**
13
     * @param TaskDefinitionInterface $taskDefinition
14
     * @return bool
15
     */
16
    public function canDispatchTaskDefinition(TaskDefinitionInterface $taskDefinition): bool
17
    {
18
        return $taskDefinition instanceof CacheClearDefinition;
19
    }
20
21
    /**
22
     * @param TaskDefinitionInterface $taskDefinition
23
     * @return DispatchResultInterface
24
     * @throws \Deployee\Plugins\Deploy\Exception\DispatcherException
25
     */
26
    public function dispatch(TaskDefinitionInterface $taskDefinition): DispatchResultInterface
27
    {
28
        $params = $taskDefinition->define();
0 ignored issues
show
Unused Code introduced by
The assignment to $params is dead and can be removed.
Loading history...
29
        return $this->delegate(new ShopwareCommandDefinition(
30
            'cache:clear',
31
            sprintf('-n %s', $this->getEnvironmentConsoleParameter($taskDefinition))
32
        ));
33
    }
34
}