Completed
Push — master ( 33842a...f1a368 )
by Baptiste
02:37
created

DataExtractorFactory::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 0
Metric Value
dl 0
loc 10
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 2
crap 2
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\Neo4jBundle\Factory;
5
6
use Innmind\Neo4j\ONM\{
7
    Metadatas,
8
    Entity\DataExtractorInterface,
9
    Entity\DataExtractor
10
};
11
use Innmind\Immutable\Map;
12
13
final class DataExtractorFactory
14
{
15 4
    public static function make(Metadatas $metadatas, array $extractors): DataExtractor
16
    {
17 4
        $map = new Map('string', DataExtractorInterface::class);
18
19 4
        foreach ($extractors as $metadata => $extractor) {
20 4
            $map = $map->put($metadata, $extractor);
21
        }
22
23 4
        return new DataExtractor($metadatas, $map);
24
    }
25
}
26