Passed
Push — master ( 5431c9...e4edfb )
by Anton
01:36
created

Relation   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 86
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 8
eloc 17
dl 0
loc 86
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A getOptions() 0 3 1
A getType() 0 3 1
A setInverse() 0 4 1
A setTarget() 0 5 1
A setType() 0 5 1
A isInverse() 0 3 1
A getTarget() 0 3 1
A setOptions() 0 4 1
1
<?php
2
declare(strict_types=1);
3
/**
4
 * Spiral Framework.
5
 *
6
 * @license   MIT
7
 * @author    Anton Titov (Wolfy-J)
8
 */
9
10
namespace Cycle\Schema\Definition;
11
12
final class Relation
13
{
14
    /** @var string */
15
    private $type;
16
17
    /** @var string */
18
    private $target;
19
20
    /** @var array */
21
    private $options = [];
22
23
    /** @var bool */
24
    private $inverse = false;
25
26
    /**
27
     * @param string $type
28
     * @return Relation
29
     */
30
    public function setType(string $type): Relation
31
    {
32
        $this->type = $type;
33
34
        return $this;
35
    }
36
37
    /**
38
     * @return string
39
     */
40
    public function getType(): string
41
    {
42
        return $this->type;
43
    }
44
45
    /**
46
     * @param string $target
47
     * @return Relation
48
     */
49
    public function setTarget(string $target): Relation
50
    {
51
        $this->target = $target;
52
53
        return $this;
54
    }
55
56
    /**
57
     * @return string
58
     */
59
    public function getTarget(): string
60
    {
61
        return $this->target;
62
    }
63
64
    /**
65
     * @param array $options
66
     * @return Relation
67
     */
68
    public function setOptions(array $options): Relation
69
    {
70
        $this->options = $options;
71
        return $this;
72
    }
73
74
    /**
75
     * @return array
76
     */
77
    public function getOptions(): array
78
    {
79
        return $this->options;
80
    }
81
82
    /**
83
     * @param bool $inverse
84
     * @return Relation
85
     */
86
    public function setInverse(bool $inverse): Relation
87
    {
88
        $this->inverse = $inverse;
89
        return $this;
90
    }
91
92
    /**
93
     * @return bool
94
     */
95
    public function isInverse(): bool
96
    {
97
        return $this->inverse;
98
    }
99
}