| Total Complexity | 6 |
| Total Lines | 49 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 14 | final class Inverse extends AbstractAnnotation |
||
| 15 | { |
||
| 16 | protected const NAME = 'inverse'; |
||
| 17 | protected const SCHEMA = [ |
||
| 18 | 'type' => Parser::STRING, |
||
| 19 | 'name' => Parser::STRING, |
||
| 20 | 'as' => Parser::STRING, // alias to name |
||
| 21 | ]; |
||
| 22 | |||
| 23 | /** @var string|null */ |
||
| 24 | protected $type; |
||
| 25 | |||
| 26 | /** @var string|null */ |
||
| 27 | protected $name; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @inheritdoc |
||
| 31 | */ |
||
| 32 | public function setAttribute(string $name, $value) |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @return bool |
||
| 43 | */ |
||
| 44 | public function isValid(): bool |
||
| 45 | { |
||
| 46 | return $this->getType() !== null && $this->getRelation() !== null; |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @return string|null |
||
| 51 | */ |
||
| 52 | public function getType(): ?string |
||
| 53 | { |
||
| 54 | return $this->type; |
||
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * @return string|null |
||
| 59 | */ |
||
| 60 | public function getRelation(): ?string |
||
| 63 | } |
||
| 64 | } |