Passed
Push — dev ( ed7e6f...6dda26 )
by Janko
25:50
created

ColonyScan::isAbandoned()   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
15
#[Table(name: 'stu_colony_scan')]
16
#[Entity(repositoryClass: 'Stu\Orm\Repository\ColonyScanRepository')]
17
class ColonyScan implements ColonyScanInterface
18
{
19
    #[Id]
20
    #[Column(type: 'integer')]
21
    #[GeneratedValue(strategy: 'IDENTITY')]
22
    private int $id;
23
24
    #[Column(type: 'integer')]
25
    private int $colony_id = 0;
26
27
    #[Column(type: 'integer')]
28
    private int $user_id = 0;
29
30
    #[Column(type: 'integer')]
31
    private int $colony_user_id = 0;
32
33
    #[Column(type: 'string', nullable: true)]
34
    private ?string $colony_name = '';
35
36
    #[Column(type: 'string')]
37
    private string $colony_user_name = '';
38
39
    #[Column(type: 'text')]
40
    private string $mask;
41
42
    #[Column(type: 'integer')]
43
    private int $date = 0;
44
45
    #[ManyToOne(targetEntity: 'Colony')]
46
    #[JoinColumn(name: 'colony_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
47
    private ColonyInterface $colony;
48
49
50
    #[ManyToOne(targetEntity: 'User')]
51
    #[JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
52
    private UserInterface $user;
53
54
55
    public function getId(): int
56
    {
57
        return $this->id;
58
    }
59
60
    public function getColonyId(): int
61
    {
62
        return $this->colony_id;
63
    }
64
65
    public function setColonyId(int $colonyid): ColonyScanInterface
66
    {
67
        $this->colony_id = $colonyid;
68
        return $this;
69
    }
70
71
    public function getUserId(): int
72
    {
73
        return $this->user_id;
74
    }
75
76
    public function setUserId(int $userid): ColonyScanInterface
77
    {
78
        $this->user_id = $userid;
79
        return $this;
80
    }
81
82
    public function getColonyUserId(): int
83
    {
84
        return $this->colony_user_id;
85
    }
86
87
    public function setColonyUserId(int $colonyuserid): ColonyScanInterface
88
    {
89
        $this->colony_user_id = $colonyuserid;
90
        return $this;
91
    }
92
93
    public function getColonyName(): ?string
94
    {
95
        return $this->colony_name;
96
    }
97
98
    public function setColonyName(?string $colonyname): ColonyScanInterface
99
    {
100
        $this->colony_name = $colonyname;
101
        return $this;
102
    }
103
104
    public function getColonyUserName(): string
105
    {
106
        return $this->colony_user_name;
107
    }
108
109
    public function setColonyUserName(string $colonyusername): ColonyScanInterface
110
    {
111
        $this->colony_user_name = $colonyusername;
112
        return $this;
113
    }
114
115
    public function getFieldData(): string
116
    {
117
        return $this->mask;
118
    }
119
120
    public function setFieldData(string $fieldData): ColonyScanInterface
121
    {
122
        $this->mask = $fieldData;
123
        return $this;
124
    }
125
126
    public function getDate(): int
127
    {
128
        return $this->date;
129
    }
130
131
    public function setDate(int $date): ColonyScanInterface
132
    {
133
        $this->date = $date;
134
        return $this;
135
    }
136
137
    public function getColony(): ColonyInterface
138
    {
139
        return $this->colony;
140
    }
141
142
    public function setColony(ColonyInterface $colony): ColonyScanInterface
143
    {
144
        $this->colony = $colony;
145
        return $this;
146
    }
147
148
    public function getUser(): UserInterface
149
    {
150
        return $this->user;
151
    }
152
153
    public function setUser(UserInterface $user): ColonyScanInterface
154
    {
155
        $this->user = $user;
156
        return $this;
157
    }
158
159
    public function isAbandoned(): bool
160
    {
161
        return $this->getColony()->getUserId() !== $this->colony_user_id;
162
    }
163
}
164