Relation::getTarget()   A
last analyzed

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
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 1
b 0
f 0
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