Map   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 24
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __toString() 0 11 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 Map implements Constructor
13
{
14
    private $key;
15
    private $value;
16
    private $arguments;
17
18 7
    public function __construct(string $key, string $value, Argument ...$arguments)
19
    {
20 7
        $this->key = $key;
21 7
        $this->value = $value;
22 7
        $this->arguments = Stream::of(Argument::class, ...$arguments);
23 7
    }
24
25 5
    public function __toString(): string
26
    {
27
        $code = <<<PHP
28
\\Innmind\\Compose\\Lazy\\Map::of(
29 5
    '{$this->key}',
30 5
    '{$this->value}',
31 5
    {$this->arguments->join(",\n")}
32
)
33
PHP;
34
35 5
        return $code;
36
    }
37
}
38