ArrayToArgumentsAction::parseArguments()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3
Metric Value
dl 0
loc 14
ccs 7
cts 7
cp 1
rs 9.4286
cc 3
eloc 8
nc 3
nop 1
crap 3
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