Passed
Push — master ( c5c3d4...6b54e3 )
by Anton
01:37
created

Relation::setInverse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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
use Cycle\Schema\Definition\Map\OptionMap;
13
14
final class Relation
15
{
16
    /** @var string */
17
    private $type;
18
19
    /** @var string */
20
    private $target;
21
22
    /** @var OptionMap */
23
    private $options;
24
25
    /** @var bool */
26
    private $inverse = false;
27
28
    /**
29
     * Relation constructor.
30
     */
31
    public function __construct()
32
    {
33
        $this->options = new OptionMap();
34
    }
35
36
    /**
37
     * @param string $type
38
     * @return Relation
39
     */
40
    public function setType(string $type): Relation
41
    {
42
        $this->type = $type;
43
44
        return $this;
45
    }
46
47
    /**
48
     * @return string
49
     */
50
    public function getType(): string
51
    {
52
        return $this->type;
53
    }
54
55
    /**
56
     * @param string $target
57
     * @return Relation
58
     */
59
    public function setTarget(string $target): Relation
60
    {
61
        $this->target = $target;
62
63
        return $this;
64
    }
65
66
    /**
67
     * @return string
68
     */
69
    public function getTarget(): string
70
    {
71
        return $this->target;
72
    }
73
74
    /**
75
     * @return OptionMap
76
     */
77
    public function getOptions(): OptionMap
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
}