DataMapActionExecutor   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 32
ccs 9
cts 9
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A execute() 0 7 1
A getSupportedAction() 0 4 1
1
<?php
2
3
namespace Thruster\Action\DataMapperActions;
4
5
use Thruster\Component\Actions\ActionExecutorInterface;
6
use Thruster\Component\DataMapper\DataMappers;
7
8
/**
9
 * Class DataMapActionExecutor
10
 *
11
 * @package Thruster\Action\DataMapperActions
12
 * @author  Aurimas Niekis <[email protected]>
13
 */
14
class DataMapActionExecutor implements ActionExecutorInterface
15
{
16
    /**
17
     * @var DataMappers
18
     */
19
    protected $dataMappers;
20
21 2
    public function __construct(DataMappers $dataMappers)
22
    {
23 2
        $this->dataMappers = $dataMappers;
24 2
    }
25
26
    /**
27
     * @inheritDoc
28
     */
29 1
    public function execute(array $arguments)
30
    {
31 1
        $mapperName = reset($arguments);
32 1
        $input = end($arguments);
33
34 1
        return $this->dataMappers->getMapper($mapperName)->map($input);
35
    }
36
37
    /**
38
     * @inheritDoc
39
     */
40 1
    public static function getSupportedAction() : string
41
    {
42 1
        return 'thruster_data_mapper_map';
43
    }
44
45
}
46