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

canDispatchTaskDefinition()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
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
}