ArrayToArgumentsAction   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 26
ccs 9
cts 9
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A parseArguments() 0 14 3
A getName() 0 4 1
1
<?php
2
3
namespace Thruster\Component\Actions\Action;
4
5
use Thruster\Component\Actions\ExecutorInterface;
6
use Thruster\Component\Actions\ExecutorLessInterface;
7
8
/**
9
 * Class ArrayToArgumentsAction
10
 *
11
 * @package Thruster\Component\Actions\Action
12
 * @author  Aurimas Niekis <[email protected]>
13
 */
14
class ArrayToArgumentsAction extends BaseAction implements ExecutorLessInterface
15
{
16 2
    public function parseArguments(ExecutorInterface $executor) : array
17
    {
18 2
        $result = [];
19
20 2
        foreach (parent::parseArguments($executor) as $argument) {
21 2
            if (is_array($argument)) {
22 2
                $result = array_merge($result, $argument);
23
            } else {
24 2
                $result[] = $argument;
25
            }
26
        }
27
28 2
        return $result;
29
    }
30
31
    /**
32
     * @inheritDoc
33
     */
34 1
    public function getName() : string
35
    {
36 1
        return 'thruster_array_to_arguments';
37
    }
38
39
}
40