Passed
Pull Request — master (#2)
by Alexander
01:11
created

ProxyContainer::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
4
namespace Yiisoft\Proxy;
5
6
use Psr\Container\ContainerInterface;
7
8
final class ProxyContainer implements ContainerInterface
9
{
10
    private ContainerInterface $proxied;
11
    private ProxyHandlerInterface $handler;
12
13 1
    public function __construct(ContainerInterface $proxied, ProxyHandlerInterface $handler)
14
    {
15 1
        $this->proxied = $proxied;
16 1
        $this->handler = $handler;
17 1
    }
18
19 1
    public function get($id)
20
    {
21 1
        $object = $this->proxied->get($id);
22 1
        return new Proxy($object, $this->handler);
23
    }
24
25
    public function has($id)
26
    {
27
        return $this->proxied->has($id);
28
    }
29
}
30