ArrayToArgumentsAction::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 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