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

WormholeRestriction   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 70
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 29
c 0
b 0
f 0
dl 0
loc 70
ccs 0
cts 22
cp 0
rs 10
wmc 9

9 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 3 1
A setWormholeEntry() 0 4 1
A setPrivilegeType() 0 4 1
A setMode() 0 4 1
A setTargetId() 0 4 1
A getPrivilegeType() 0 3 1
A getMode() 0 3 1
A getWormholeEntry() 0 3 1
A getTargetId() 0 3 1
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