Passed
Push — dev ( 7914d2...bbc331 )
by Janko
10:29
created

UserLock::getUserId()   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\Index;
12
use Doctrine\ORM\Mapping\JoinColumn;
13
use Doctrine\ORM\Mapping\OneToOne;
14
use Doctrine\ORM\Mapping\Table;
15
use Stu\Orm\Repository\UserLockRepository;
16
17
#[Table(name: 'stu_user_lock')]
18
#[Index(name: 'user_lock_user_idx', columns: ['user_id'])]
19
#[Entity(repositoryClass: UserLockRepository::class)]
20
class UserLock
21
{
22
    #[Id]
23
    #[Column(type: 'integer')]
24
    #[GeneratedValue(strategy: 'IDENTITY')]
25
    private int $id;
26
27
    #[Column(type: 'integer', nullable: true)]
28
    private ?int $former_user_id = null;
29
30
    #[Column(type: 'integer')]
31
    private int $remaining_ticks = 0;
32
33
    #[Column(type: 'text')]
34
    private string $reason = '';
35
36
    #[OneToOne(targetEntity: User::class, inversedBy: 'userLock')]
37
    #[JoinColumn(name: 'user_id', nullable: true, referencedColumnName: 'id', onDelete: 'CASCADE')]
38
    private ?User $user = null;
39
40
    public function getId(): int
41
    {
42
        return $this->id;
43
    }
44
45
    public function getUser(): ?User
46
    {
47
        return $this->user;
48
    }
49
50
    public function setUser(?User $user): UserLock
51
    {
52
        $this->user = $user;
53
        return $this;
54
    }
55
56
    public function setFormerUserId(?int $userId): UserLock
57
    {
58
        $this->former_user_id = $userId;
59
        return $this;
60
    }
61
62
    public function getRemainingTicks(): int
63
    {
64
        return $this->remaining_ticks;
65
    }
66
67
    public function setRemainingTicks(int $count): UserLock
68
    {
69
        $this->remaining_ticks = $count;
70
        return $this;
71
    }
72
73
    public function getReason(): string
74
    {
75
        return $this->reason;
76
    }
77
78
    public function setReason(string $reason): UserLock
79
    {
80
        $this->reason = $reason;
81
82
        return $this;
83
    }
84
}
85