Passed
Push — master ( a600df...e0fe4b )
by FX
02:35
created

Project::getSuccessLimit()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
/**
3
 * Copyright (c) 2017 Francois-Xavier Soubirou.
4
 *
5
 * This file is part of ci-report.
6
 *
7
 * ci-report is free software: you can redistribute it and/or modify
8
 * it under the terms of the GNU General Public License as published by
9
 * the Free Software Foundation, either version 3 of the License, or
10
 * (at your option) any later version.
11
 *
12
 * ci-report is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
 * GNU General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU General Public License
18
 * along with ci-report. If not, see <http://www.gnu.org/licenses/>.
19
 */
20
declare(strict_types=1);
21
22
namespace AppBundle\Entity;
23
24
use Doctrine\ORM\Mapping as ORM;
25
use JMS\Serializer\Annotation as Serializer;
26
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
27
use Symfony\Component\Validator\Constraints as Assert;
28
29
/**
30
 * Project entity class.
31
 *
32
 * @category  ci-report app
33
 *
34
 * @author    Francois-Xavier Soubirou <[email protected]>
35
 * @copyright 2017 Francois-Xavier Soubirou
36
 * @license   http://www.gnu.org/licenses/   GPLv3
37
 *
38
 * @see      https://ci-report.io
39
 *
40
 * @ORM\Table(name="cir_project")
41
 * @ORM\Entity(repositoryClass="AppBundle\Repository\ProjectRepository")
42
 *
43
 * @UniqueEntity("name")
44
 *
45
 * @Serializer\ExclusionPolicy("ALL")
46
 */
47
class Project
48
{
49
    const DEFAULT_WARNING_LIMIT = 80;
50
    const DEFAULT_SUCCESS_LIMIT = 95;
51
52
    /**
53
     * @var int
54
     *
55
     * @ORM\Column(name="id", type="integer")
56
     * @ORM\Id
57
     * @ORM\GeneratedValue(strategy="AUTO")
58
     */
59
    private $id;
60
61
    /**
62
     * @var string
63
     *
64
     * @ORM\Column(name="name", type="string", length=50, unique=true)
65
     *
66
     * @Assert\NotBlank
67
     *
68
     * @Serializer\Expose
69
     */
70
    private $name;
71
72
    /**
73
     * @var string
74
     *
75
     * @ORM\Column(name="refid", type="string", length=50, unique=true)
76
     *
77
     * @Serializer\Expose
78
     */
79
    private $refId;
80
81
    /**
82
     * @var string
83
     *
84
     * @ORM\Column(name="token", type="string", length=50)
85
     */
86
    private $token;
87
88
    /**
89
     * @var int
90
     *
91
     * @ORM\Column(name="warning_limit", type="smallint")
92
     *
93
     * @Serializer\Expose
94
     */
95
    private $warningLimit;
96
97
    /**
98
     * @var int
99
     *
100
     * @ORM\Column(name="success_limit", type="smallint")
101
     *
102
     * @Serializer\Expose
103
     */
104
    private $successLimit;
105
106
    /**
107
     * Constructor.
108
     */
109
    public function __construct()
110
    {
111
        $this->setWarningLimit(self::DEFAULT_WARNING_LIMIT);
112
        $this->setSuccessLimit(self::DEFAULT_SUCCESS_LIMIT);
113
    }
114
115
    /**
116
     * Get id.
117
     *
118
     * @return int
119
     */
120
    public function getId(): int
121
    {
122
        return $this->id;
123
    }
124
125
    /**
126
     * Set name.
127
     *
128
     * @param string $name
129
     *
130
     * @return Project
131
     */
132
    public function setName(string $name): Project
133
    {
134
        $this->name = $name;
135
136
        return $this;
137
    }
138
139
    /**
140
     * Get name.
141
     *
142
     * @return string
143
     */
144
    public function getName(): string
145
    {
146
        return $this->name;
147
    }
148
149
    /**
150
     * Set refId.
151
     *
152
     * @param string $refId
153
     *
154
     * @return Project
155
     */
156
    public function setRefId(string $refId): Project
157
    {
158
        $this->refId = $refId;
159
160
        return $this;
161
    }
162
163
    /**
164
     * Get refId.
165
     *
166
     * @return string
167
     */
168
    public function getRefId(): string
169
    {
170
        return $this->refId;
171
    }
172
173
    /**
174
     * Set token.
175
     *
176
     * @param string $token
177
     *
178
     * @return Project
179
     */
180
    public function setToken(string $token): Project
181
    {
182
        $this->token = $token;
183
184
        return $this;
185
    }
186
187
    /**
188
     * Get token.
189
     *
190
     * @return string
191
     */
192
    public function getToken(): string
193
    {
194
        return $this->token;
195
    }
196
197
    /**
198
     * Set warning limit.
199
     *
200
     * @param int $warningLimit
201
     *
202
     * @return Project
203
     */
204
    public function setWarningLimit(int $warningLimit): Project
205
    {
206
        $this->warningLimit = $warningLimit;
207
208
        return $this;
209
    }
210
211
    /**
212
     * Get warning limit.
213
     *
214
     * @return int
215
     */
216
    public function getWarningLimit(): ?int
217
    {
218
        return $this->warningLimit;
219
    }
220
221
    /**
222
     * Set success limit.
223
     *
224
     * @param int $successLimit
225
     *
226
     * @return Project
227
     */
228
    public function setSuccessLimit(int $successLimit): Project
229
    {
230
        $this->successLimit = $successLimit;
231
232
        return $this;
233
    }
234
235
    /**
236
     * Get success limit.
237
     *
238
     * @return int
239
     */
240
    public function getSuccessLimit(): ?int
241
    {
242
        return $this->successLimit;
243
    }
244
}
245