Completed
Push — master ( a73fad...f8ec74 )
by Baptiste
02:31
created

DelegationBuilderFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 22
ccs 9
cts 9
cp 1
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A make() 0 10 2
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\Rest\ServerBundle\Factory;
5
6
use Innmind\Immutable\Set;
7
8
final class DelegationBuilderFactory
9
{
10
    private $class;
11
    private $interface;
12
13 11
    public function __construct(string $class, string $interface)
14
    {
15 11
        $this->class = $class;
16 11
        $this->interface = $interface;
17 11
    }
18
19 11
    public function make(array $builders)
20
    {
21 11
        $set = new Set($this->interface);
22
23 11
        foreach ($builders as $builder) {
24 7
            $set = $set->add($builder);
25
        }
26
27 11
        return new $this->class($set);
28
    }
29
}
30