Passed
Push — 2.x ( 0b5227...cb81b7 )
by butschster
16:17
created

EmptyReference   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 40%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
dl 0
loc 31
ccs 4
cts 10
cp 0.4
rs 10
c 1
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getScope() 0 3 1
A setValue() 0 3 1
A getValue() 0 3 1
A getRole() 0 3 1
A hasValue() 0 3 1
A __construct() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cycle\ORM\Reference;
6
7
final class EmptyReference implements ReferenceInterface
8
{
9
    public function __construct(
10
        private string $role,
11
        private mixed $value
12
    ) {
13
    }
14
15
    public function getRole(): string
16
    {
17
        return $this->role;
18
    }
19
20
    public function getScope(): array
21
    {
22
        throw new \RuntimeException();
23
    }
24
25 144
    public function hasValue(): bool
26
    {
27 144
        return true;
28
    }
29
30
    public function setValue(mixed $value): void
31
    {
32
        $this->value = $value;
33
    }
34
35 144
    public function getValue(): mixed
36
    {
37 144
        return $this->value;
38
    }
39
}
40