Passed
Push — main ( 438344...ee0fb9 )
by Thomas
02:54
created

RegistryTag::entry()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Conia\Chuck;
6
7
class RegistryTag
8
{
9
    /**
10
     * @param non-empty-string $id
0 ignored issues
show
Documentation Bug introduced by
The doc comment non-empty-string at position 0 could not be parsed: Unknown type name 'non-empty-string' at position 0 in non-empty-string.
Loading history...
11
     * */
12 3
    public function __construct(
13
        readonly protected string $tag,
14
        readonly protected Registry $registry,
15
    ) {
16 3
    }
17
18 1
    public function has(string $id): mixed
19
    {
20 1
        return $this->registry->hasTagged($this->tag, $id);
21
    }
22
23 2
    public function entry(string $id): RegistryEntry
24
    {
25 2
        return $this->registry->taggedEntry($this->tag, $id);
26
    }
27
28 2
    public function get(string $id): mixed
29
    {
30 2
        return $this->registry->getTagged($this->tag, $id);
31
    }
32
33
    /**
34
     * @param non-empty-string $id
0 ignored issues
show
Documentation Bug introduced by
The doc comment non-empty-string at position 0 could not be parsed: Unknown type name 'non-empty-string' at position 0 in non-empty-string.
Loading history...
35
     */
36 2
    public function add(string $id, mixed $value = null): RegistryEntry
37
    {
38 2
        return $this->registry->addTagged($this->tag, $id, $value);
39
    }
40
}
41