DataModifyActionExecutor::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Thruster\Action\DataModifierActions;
4
5
use Thruster\Component\Actions\ActionExecutorInterface;
6
use Thruster\Component\DataModifier\DataModifierGroups;
7
8
/**
9
 * Class DataModifyActionExecutor
10
 *
11
 * @package Thruster\Action\DataModifierActions
12
 * @author  Aurimas Niekis <[email protected]>
13
 */
14
class DataModifyActionExecutor implements ActionExecutorInterface
15
{
16
    /**
17
     * @var DataModifierGroups
18
     */
19
    protected $dataModifierGroups;
20
21 1
    public function __construct(DataModifierGroups $dataModifierGroups)
22
    {
23 1
        $this->dataModifierGroups = $dataModifierGroups;
24 1
    }
25
26
    /**
27
     * @inheritDoc
28
     */
29 1
    public function execute(array $arguments)
30
    {
31 1
        $groupName = reset($arguments);
32 1
        $input = end($arguments);
33
34 1
        return $this->dataModifierGroups->getGroup($groupName)->modify($input);
35
    }
36
37
    /**
38
     * @inheritDoc
39
     */
40 1
    public static function getSupportedAction() : string
41
    {
42 1
        return 'thruster_data_modifier_modify';
43
    }
44
}
45