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

ProxyContainer   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 77.78%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 8
c 1
b 0
f 0
dl 0
loc 20
ccs 7
cts 9
cp 0.7778
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A get() 0 4 1
A has() 0 3 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