Passed
Push — master ( 53821d...e70153 )
by Phillip
03:50
created

PluginRefreshDispatcher   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 22
ccs 0
cts 10
cp 0
rs 10
c 0
b 0
f 0
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\PluginRefreshDefinition;
8
use Deployee\Plugins\ShopwareTasks\Definitions\ShopwareCommandDefinition;
9
10
class PluginRefreshDispatcher extends AbstractShopwareDispatcher
11
{
12
    /**
13
     * @param TaskDefinitionInterface $taskDefinition
14
     * @return bool
15
     */
16
    public function canDispatchTaskDefinition(TaskDefinitionInterface $taskDefinition): bool
17
    {
18
        return $taskDefinition instanceof PluginRefreshDefinition;
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
            'sw:plugin:refresh',
31
            sprintf('-n %s', $this->getEnvironmentConsoleParameter($taskDefinition))
32
        ));
33
    }
34
}