Concat::run()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 15
ccs 10
cts 10
cp 1
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 10
nc 3
nop 1
crap 3
1
<?php
2
namespace Desmond\functions\core;
3
use Desmond\functions\DesmondFunction;
4
use Desmond\ArgumentHelper;
5
6
class Concat extends DesmondFunction
7
{
8
    use ArgumentHelper;
9
10 334
    public function id()
11
    {
12 334
        return 'concat';
13
    }
14
15 6
    public function run(array $args)
16
    {
17 6
        $this->expectArguments(
18 6
            'concat',
19 6
            [0 => ['List'], 1 => ['List']],
20 6
            $args
21
        );
22 4
        $newList = $this->newReturnType('List');
23 4
        foreach ($args as $list) {
24 4
            foreach ($list->value() as $value) {
25 4
                $newList->set($value);
26
            }
27
        }
28 4
        return $newList;
29
    }
30
}
31