Completed
Push — develop ( 88b170...792ec8 )
by Baptiste
02:04
created

Psr7TranslatorFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 18
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A make() 0 15 2
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\Rest\ClientBundle;
5
6
use Innmind\Http\{
7
    Translator\Response\Psr7Translator,
8
    Factory\HeaderFactoryInterface,
9
    Factory\Header\DefaultFactory
10
};
11
use Innmind\Immutable\Map;
12
13
final class Psr7TranslatorFactory
14
{
15 1
    public function make(array $classes): Psr7Translator
16
    {
17 1
        $factories = new Map('string', HeaderFactoryInterface::class);
18
19 1
        foreach ($classes as $class => $header) {
20 1
            $factories = $factories->put(
21
                $header,
22 1
                new $class
23
            );
24
        }
25
26 1
        return new Psr7Translator(
27 1
            new DefaultFactory($factories)
28
        );
29
    }
30
}
31