ServiceFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 18
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __toString() 0 5 1
A __construct() 0 5 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\Compose\Compilation\Service\Constructor;
5
6
use Innmind\Compose\{
7
    Compilation\Service\Constructor,
8
    Compilation\Service\Argument
9
};
10
use Innmind\Immutable\Stream;
11
12
final class ServiceFactory implements Constructor
13
{
14
    private $factory;
15
    private $method;
16
    private $arguments;
17
18 3
    public function __construct(string $method, Argument $factory, Argument ...$arguments)
19
    {
20 3
        $this->factory = $factory;
21 3
        $this->method = $method;
22 3
        $this->arguments = Stream::of(Argument::class, ...$arguments);
23 3
    }
24
25 1
    public function __toString(): string
26
    {
27
        return <<<PHP
28 1
{$this->factory}->{$this->method}(
29 1
{$this->arguments->join(",\n")}
30
)
31
PHP;
32
    }
33
}
34