Factory::__construct()   A
last analyzed

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 0
Metric Value
cc 1
eloc 3
nc 1
nop 3
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 10
c 0
b 0
f 0
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 Factory implements Constructor
13
{
14
    private $class;
15
    private $method;
16
    private $arguments;
17
18 3
    public function __construct(string $class, string $method, Argument ...$arguments)
19
    {
20 3
        $this->class = $class;
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
        $code = <<<PHP
28 1
\\{$this->class}::{$this->method}(
29 1
{$this->arguments->join(",\n")}
30
)
31
PHP;
32
33 1
        return $code;
34
    }
35
}
36