Passed
Push — master ( 4be7e9...eef0b9 )
by Anton
01:32
created

Inversed   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 10
dl 0
loc 36
c 0
b 0
f 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getRelation() 0 3 1
A getType() 0 3 1
A isValid() 0 3 2
1
<?php declare(strict_types=1);
2
/**
3
 * Spiral Framework.
4
 *
5
 * @license   MIT
6
 * @author    Anton Titov (Wolfy-J)
7
 */
8
9
namespace Cycle\Annotated\Annotation\Relation;
10
11
use Spiral\Annotations\AbstractAnnotation;
12
use Spiral\Annotations\Parser;
13
14
final class Inversed extends AbstractAnnotation
15
{
16
    protected const INVERSED = 'inversed';
17
    protected const SCHEMA   = [
18
        'type' => Parser::STRING,
19
        'name' => Parser::STRING
20
    ];
21
22
    /** @var string|null */
23
    protected $type;
24
25
    /** @var string|null */
26
    protected $name;
27
28
    /**
29
     * @return bool
30
     */
31
    public function isValid(): bool
32
    {
33
        return $this->type !== null && $this->name !== null;
34
    }
35
36
    /**
37
     * @return string|null
38
     */
39
    public function getType(): ?string
40
    {
41
        return $this->type;
42
    }
43
44
    /**
45
     * @return string|null
46
     */
47
    public function getRelation(): ?string
48
    {
49
        return $this->name;
50
    }
51
}