Completed
Push — master ( 14bf01...b7c3ef )
by FX
04:41
created

SuiteLimitsDTO::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
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\DTO;
23
24
use AppBundle\Entity\Project;
25
use JMS\Serializer\Annotation\Type;
26
use Symfony\Component\Validator\Constraints as Assert;
27
28
/**
29
 * Suite limits data transfert object class.
30
 *
31
 * @category  ci-report app
32
 *
33
 * @author    Francois-Xavier Soubirou <[email protected]>
34
 * @copyright 2017 Francois-Xavier Soubirou
35
 * @license   http://www.gnu.org/licenses/   GPLv3
36
 *
37
 * @see      https://www.ci-report.io
38
 */
39
class SuiteLimitsDTO
40
{
41
    /**
42
     * Tests warning limit. Integer between 0 and 100 %. Limit defined on project by default.
43
     *
44
     * @var int
45
     *
46
     * @Type("integer")
47
     *
48
     * @Assert\Type("integer")
49
     * @Assert\Range(min=0, max=100)
50
     */
51
    protected $warning;
52
53
    /**
54
     * Tests success limit. Integer between 0 and 100 %. Limit defined on project by default.
55
     *
56
     * @var int
57
     *
58
     * @Type("integer")
59
     *
60
     * @Assert\Type("integer")
61
     * @Assert\Range(min=0, max=100)
62
     */
63
    protected $success;
64
65
    /**
66
     * Constructor.
67
     */
68
    public function __construct()
69
    {
70
        $this->setWarning(Project::DEFAULT_WARNING_LIMIT);
71
        $this->setSuccess(Project::DEFAULT_SUCCESS_LIMIT);
72
    }
73
74
    /**
75
     * Set warning limit.
76
     *
77
     * @param int $warning
78
     *
79
     * @return SuiteDTO
80
     */
81
    public function setWarning(int $warning): SuiteDTO
82
    {
83
        $this->warning = $warning;
84
85
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type AppBundle\DTO\SuiteLimitsDTO which includes types incompatible with the type-hinted return AppBundle\DTO\SuiteDTO.
Loading history...
86
    }
87
88
    /**
89
     * Get warning limit.
90
     *
91
     * @return int
92
     */
93
    public function getWarning(): ?int
94
    {
95
        return $this->warning;
96
    }
97
98
    /**
99
     * Set success limit.
100
     *
101
     * @param int $success
102
     *
103
     * @return SuiteDTO
104
     */
105
    public function setSuccess(int $success): SuiteDTO
106
    {
107
        $this->success = $success;
108
109
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type AppBundle\DTO\SuiteLimitsDTO which includes types incompatible with the type-hinted return AppBundle\DTO\SuiteDTO.
Loading history...
110
    }
111
112
    /**
113
     * Get success limit.
114
     *
115
     * @return int
116
     */
117
    public function getSuccess(): ?int
118
    {
119
        return $this->success;
120
    }
121
}
122