Completed
Push — develop ( 15ec3c...8b62a8 )
by Baptiste
02:19
created

Pair::__toString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 6
ccs 3
cts 3
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\Compose\Compilation\Service\Argument;
5
6
use Innmind\Compose\{
7
    Compilation\Service\Argument,
8
    Compilation\MethodName,
9
    Exception\LogicException
10
};
11
12
final class Pair implements Argument
13
{
14
    private $key;
15
    private $value;
16
17 6
    public function __construct(Argument $key, Argument $value)
18
    {
19 6
        $this->key = new Lazy($key);
20 6
        $this->value = new Lazy($value);
21 6
    }
22
23 1
    public function method(): MethodName
24
    {
25 1
        throw new LogicException('Argument pair cannot be accessed from outside the compiled container');
26
    }
27
28 3
    public function __toString(): string
29
    {
30
        return <<<PHP
31
new \\Innmind\\Immutable\\Pair(
32 3
    {$this->key},
33 3
    {$this->value}
34
)
35
PHP;
36
    }
37
}
38