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

VendorNamespace   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 23
rs 10
c 1
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A load() 0 2 1
A hasNamespace() 0 7 2
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