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

Tunnel::__toString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
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\Argument;
5
6
use Innmind\Compose\{
7
    Compilation\Service\Argument,
8
    Compilation\MethodName,
9
    Definition\Name,
10
    Exception\LogicException
11
};
12
13
final class Tunnel implements Argument
14
{
15
    private $dependency;
16
    private $method;
17
18 6
    public function __construct(Name $dependency, MethodName $method)
19
    {
20 6
        $this->dependency = $dependency;
21 6
        $this->method = $method;
22 6
    }
23
24 1
    public function method(): MethodName
25
    {
26 1
        throw new LogicException('Tunnel cannot be accessed from outside the compiled container');
27
    }
28
29 3
    public function __toString(): string
30
    {
31 3
        return sprintf('$this->%s->%s()', $this->dependency, $this->method);
32
    }
33
}
34