Relation   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 83.33%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 36
ccs 10
cts 12
cp 0.8333
rs 10
c 2
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getType() 0 3 1
A getLoad() 0 3 1
A __construct() 0 4 1
A getTarget() 0 3 1
A getOptions() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cycle\Annotated\Annotation\Relation;
6
7
abstract class Relation implements RelationInterface
8
{
9
    // relation type
10
    protected const TYPE = '';
11
12
    /**
13
     * @param non-empty-string|null $target
0 ignored issues
show
Documentation Bug introduced by
The doc comment non-empty-string|null at position 0 could not be parsed: Unknown type name 'non-empty-string' at position 0 in non-empty-string|null.
Loading history...
14
     * @param non-empty-string $load
15
     */
16 808
    public function __construct(
17
        protected ?string $target,
18
        protected string $load = 'lazy',
19
    ) {
20 808
    }
21
22 808
    public function getType(): string
23
    {
24 808
        return static::TYPE;
25
    }
26
27 808
    public function getTarget(): ?string
28
    {
29 808
        return $this->target;
30
    }
31
32
    public function getLoad(): ?string
33
    {
34
        return $this->load;
35
    }
36
37 808
    public function getOptions(): array
38
    {
39 808
        $options = get_object_vars($this);
40 808
        unset($options['target'], $options['inverse']);
41
42 808
        return $options;
43
    }
44
}
45