Completed
Push — develop ( f8a065...99d87a )
by Baptiste
03:38
created

DelegationBuilderFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
crap 1
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 6
    public function __construct(string $class, string $interface)
14
    {
15 6
        $this->class = $class;
16 6
        $this->interface = $interface;
17 6
    }
18
19 6
    public function make(array $builders)
20
    {
21 6
        $set = new Set($this->interface);
22
23 6
        foreach ($builders as $builder) {
24 6
            $set = $set->add($builder);
25
        }
26
27 6
        return new $this->class($set);
28
    }
29
}
30