Test Failed
Push — master ( 36eeda...83b81c )
by BruceScrutinizer
08:00
created

VendorNamespace::load()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
nc 1
nop 0
dl 0
loc 2
rs 10
c 1
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace NamespaceProtector\Metadata;
4
5
use NamespaceProtector\Entry\Entry;
6
use NamespaceProtector\Db\DbKeyValue;
7
use NamespaceProtector\Db\MatchCollectionInterface;
8
use NamespaceProtector\Parser\Node\EmptyMatchedResult;
9
use NamespaceProtector\Parser\Node\MatchedResult;
10
use NamespaceProtector\Parser\Node\MatchedResultInterface;
11
12
class VendorNamespace implements VendorNamespaceInterface
13
{
14
    private MatchCollectionInterface $macher;
15
16
    private DbKeyValue $collection;
17
18
    public function __construct(MatchCollectionInterface $macher)
19
    {
20
        $this->macher = $macher;
21
        $this->collection = new DbKeyValue();
22
    }
23
24
    public function load(): void
25
    {
26
    }
27
28
    public function hasNamespace(Entry $entry): MatchedResultInterface
29
    {
30
        if ($this->collection->booleanSearch($this->macher, $entry)) {
31
            return new MatchedResult($entry->get());
32
        }
33
34
        return new EmptyMatchedResult();
35
    }
36
}
37