Construct::__toString()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 5
ccs 3
cts 3
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 Construct implements Constructor
13
{
14
    private $construct;
15
    private $arguments;
16
17 9
    public function __construct(string $construct, Argument ...$arguments)
18
    {
19 9
        $this->construct = $construct;
20 9
        $this->arguments = Stream::of(Argument::class, ...$arguments);
21 9
    }
22
23 7
    public function __toString(): string
24
    {
25
        return <<<PHP
26 7
new \\{$this->construct}(
27 7
{$this->arguments->join(",\n")}
28
)
29
PHP;
30
    }
31
}
32