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

DummyContainer::has()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
4
namespace Yiisoft\Proxy\Tests;
5
6
7
use Psr\Container\ContainerInterface;
8
9
final class DummyContainer implements ContainerInterface
10
{
11
    private array $instances = [];
12
13
    public function get($id)
14
    {
15
        if ($id === Proxied::class) {
16
            return $this->instances[$id] ?? ($this->instances[$id] = new Proxied());
17
        }
18
19
        throw new NotFoundException("$id not found in container.");
20
    }
21
22
    public function has($id): bool
23
    {
24
        return $id === Proxied::class;
25
    }
26
}
27