| Total Complexity | 10 |
| Total Lines | 92 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | final class Relation |
||
| 16 | { |
||
| 17 | /** @var OptionMap */ |
||
| 18 | private $options; |
||
| 19 | |||
| 20 | /** @var string */ |
||
| 21 | private $type; |
||
| 22 | |||
| 23 | /** @var string */ |
||
| 24 | private $target; |
||
| 25 | |||
| 26 | /** @var bool */ |
||
| 27 | private $inverse = false; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Relation constructor. |
||
| 31 | */ |
||
| 32 | public function __construct() |
||
| 33 | { |
||
| 34 | $this->options = new OptionMap(); |
||
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @return OptionMap |
||
| 39 | */ |
||
| 40 | public function getOptions(): OptionMap |
||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @param string $type |
||
| 47 | * @return Relation |
||
| 48 | */ |
||
| 49 | public function setType(string $type): Relation |
||
| 50 | { |
||
| 51 | $this->type = $type; |
||
| 52 | |||
| 53 | return $this; |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @return string |
||
| 58 | */ |
||
| 59 | public function getType(): string |
||
| 66 | } |
||
| 67 | |||
| 68 | /** |
||
| 69 | * @param string $target |
||
| 70 | * @return Relation |
||
| 71 | */ |
||
| 72 | public function setTarget(string $target): Relation |
||
| 73 | { |
||
| 74 | $this->target = $target; |
||
| 75 | |||
| 76 | return $this; |
||
| 77 | } |
||
| 78 | |||
| 79 | /** |
||
| 80 | * @return string |
||
| 81 | */ |
||
| 82 | public function getTarget(): string |
||
| 83 | { |
||
| 84 | if ($this->target === null) { |
||
| 85 | throw new RelationException("Relation target must be set"); |
||
| 86 | } |
||
| 87 | |||
| 88 | return $this->target; |
||
| 89 | } |
||
| 90 | |||
| 91 | /** |
||
| 92 | * @param bool $inverse |
||
| 93 | * @return Relation |
||
| 94 | */ |
||
| 95 | public function setInverse(bool $inverse): Relation |
||
| 99 | } |
||
| 100 | |||
| 101 | /** |
||
| 102 | * @return bool |
||
| 103 | */ |
||
| 104 | public function isInverse(): bool |
||
| 107 | } |
||
| 108 | } |