Completed
Push — master ( f20bc4...886a11 )
by Baptiste
02:52 queued 43s
created

MapFactory::make()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
dl 0
loc 10
ccs 5
cts 5
cp 1
rs 9.4285
c 2
b 0
f 0
cc 2
eloc 5
nc 2
nop 3
crap 2
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\Neo4jBundle\Factory;
5
6
use Innmind\Immutable\Map;
7
8
class MapFactory
9
{
10 5
    public static function make(string $class, string $type, array $elements)
11
    {
12 5
        $map = new Map('string', $type);
13
14 5
        foreach ($elements as $key => $element) {
15 5
            $map = $map->put($key, $element);
16
        }
17
18 5
        return new $class($map);
19
    }
20
}
21