Passed
Push — master ( 4d4163...319ade )
by Nico
10:25 queued 04:57
created

WormholeRestriction::getWormholeEntry()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Orm\Entity;
6
7
use Doctrine\ORM\Mapping\Column;
8
use Doctrine\ORM\Mapping\Entity;
9
use Doctrine\ORM\Mapping\GeneratedValue;
10
use Doctrine\ORM\Mapping\Id;
11
use Doctrine\ORM\Mapping\JoinColumn;
12
use Doctrine\ORM\Mapping\ManyToOne;
13
use Doctrine\ORM\Mapping\Table;
14
use Stu\Component\Ship\Wormhole\WormholeEntryTypeEnum;
15
use Stu\Component\Ship\Wormhole\WormholeEntryModeEnum;
16
use Stu\Orm\Repository\WormholeRestrictionRepository;
17
18
#[Table(name: 'stu_wormhole_restrictions')]
19
#[Entity(repositoryClass: WormholeRestrictionRepository::class)]
20
class WormholeRestriction
21
{
22
    #[Id]
23
    #[Column(type: 'integer')]
24
    #[GeneratedValue(strategy: 'IDENTITY')]
25
    private int $id;
26
27
    #[ManyToOne(targetEntity: WormholeEntry::class)]
28
    #[JoinColumn(name: 'wormhole_entry_id', nullable: false, referencedColumnName: 'id')]
29
    private WormholeEntry $wormholeEntry;
30
31
    #[Column(type: 'integer')]
32
    private int $target = 0;
33
34
    #[Column(type: 'smallint', enumType: WormholeEntryTypeEnum::class, nullable: true)]
35
    private ?WormholeEntryTypeEnum $privilege_type = null;
36
37
    #[Column(type: 'integer', nullable: true)]
38
    private ?int $mode = WormholeEntryModeEnum::ALLOW->value;
39
40
    public function getId(): int
41
    {
42
        return $this->id;
43
    }
44
45
    public function getWormholeEntry(): WormholeEntry
46
    {
47
        return $this->wormholeEntry;
48
    }
49
50
    public function setWormholeEntry(WormholeEntry $wormholeEntry): WormholeRestriction
51
    {
52
        $this->wormholeEntry = $wormholeEntry;
53
        return $this;
54
    }
55
56
    public function getTargetId(): int
57
    {
58
        return $this->target;
59
    }
60
61
    public function setTargetId(int $targetId): WormholeRestriction
62
    {
63
        $this->target = $targetId;
64
        return $this;
65
    }
66
67
    public function getPrivilegeType(): ?WormholeEntryTypeEnum
68
    {
69
        return $this->privilege_type;
70
    }
71
72
    public function setPrivilegeType(?WormholeEntryTypeEnum $privilegeType): WormholeRestriction
73
    {
74
        $this->privilege_type = $privilegeType;
75
        return $this;
76
    }
77
78
79
    public function getMode(): ?int
80
    {
81
        return $this->mode;
82
    }
83
84
    public function setMode(?int $mode): WormholeRestriction
85
    {
86
        $this->mode = $mode;
87
        return $this;
88
    }
89
}
90