Passed
Push — master ( 6b54e3...ae25c0 )
by Anton
01:55
created

Relation   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 78
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 78
rs 10
c 0
b 0
f 0
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getType() 0 3 1
A setInverse() 0 4 1
A __construct() 0 3 1
A setTarget() 0 5 1
A setType() 0 5 1
A isInverse() 0 3 1
A getTarget() 0 3 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
use Cycle\Schema\Definition\Traits\OptionsTrait;
14
15
final class Relation
16
{
17
    use OptionsTrait;
18
19
    /** @var string */
20
    private $type;
21
22
    /** @var string */
23
    private $target;
24
25
    /** @var OptionMap */
26
    private $options;
27
28
    /** @var bool */
29
    private $inverse = false;
30
31
    /**
32
     * Relation constructor.
33
     */
34
    public function __construct()
35
    {
36
        $this->options = new OptionMap();
37
    }
38
39
    /**
40
     * @param string $type
41
     * @return Relation
42
     */
43
    public function setType(string $type): Relation
44
    {
45
        $this->type = $type;
46
47
        return $this;
48
    }
49
50
    /**
51
     * @return string
52
     */
53
    public function getType(): string
54
    {
55
        return $this->type;
56
    }
57
58
    /**
59
     * @param string $target
60
     * @return Relation
61
     */
62
    public function setTarget(string $target): Relation
63
    {
64
        $this->target = $target;
65
66
        return $this;
67
    }
68
69
    /**
70
     * @return string
71
     */
72
    public function getTarget(): string
73
    {
74
        return $this->target;
75
    }
76
77
    /**
78
     * @param bool $inverse
79
     * @return Relation
80
     */
81
    public function setInverse(bool $inverse): Relation
82
    {
83
        $this->inverse = $inverse;
84
        return $this;
85
    }
86
87
    /**
88
     * @return bool
89
     */
90
    public function isInverse(): bool
91
    {
92
        return $this->inverse;
93
    }
94
}