Completed
Push — master ( d315c2...14bf01 )
by FX
02:42
created

SuiteDTO::setSuccess()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
rs 9.4285
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 DateTime;
25
use JMS\Serializer\Annotation\Type;
26
use Symfony\Component\Validator\Constraints as Assert;
27
28
/**
29
 * Suite 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 SuiteDTO extends SuiteLimitsDTO
40
{
41
    /**
42
     * Name of the suite.
43
     *
44
     * @var string
45
     *
46
     * @Type("string")
47
     *
48
     * @Assert\NotBlank
49
     */
50
    private $name;
51
52
    /**
53
     * Number of disabled tests.
54
     *
55
     * @var int
56
     *
57
     * @Type("integer")
58
     *
59
     * @Assert\Type("integer")
60
     * @Assert\GreaterThanOrEqual(0)
61
     */
62
    private $disabled = 0;
63
64
    /**
65
     * Duration of the suite in seconds.
66
     *
67
     * @var float
68
     *
69
     * @Type("float")
70
     *
71
     * @Assert\Type("float")
72
     * @Assert\GreaterThanOrEqual(0)
73
     */
74
    private $duration = 0;
75
76
    /**
77
     * Date time of the suite in format (2017-07-01T12:30:01). Now by default.
78
     *
79
     * @var DateTime
80
     *
81
     * @Type("DateTime<'Y-m-d\TH:i:s'>")
82
     *
83
     * @Assert\DateTime()
84
     */
85
    private $datetime;
86
87
    /**
88
     * Set name.
89
     *
90
     * @param string $name
91
     *
92
     * @return SuiteDTO
93
     */
94
    public function setName(string $name): SuiteDTO
95
    {
96
        $this->name = $name;
97
98
        return $this;
99
    }
100
101
    /**
102
     * Get name.
103
     *
104
     * @return string
105
     */
106
    public function getName(): string
107
    {
108
        return $this->name;
109
    }
110
111
    /**
112
     * Set disabled tests count.
113
     *
114
     * @param int $disabled Disable tests
115
     *
116
     * @return SuiteDTO
117
     */
118
    public function setDisabled(int $disabled): SuiteDTO
119
    {
120
        $this->disabled = $disabled;
121
122
        return $this;
123
    }
124
125
    /**
126
     * Get disabled tests count.
127
     *
128
     * @return int
129
     */
130
    public function getDisabled(): int
131
    {
132
        return $this->disabled;
133
    }
134
135
    /**
136
     * Set duration of the suite in second.
137
     *
138
     * @param float $duration Duration
139
     *
140
     * @return SuiteDTO
141
     */
142
    public function setDuration(float $duration): SuiteDTO
143
    {
144
        $this->duration = $duration;
145
146
        return $this;
147
    }
148
149
    /**
150
     * Get duration of the suite in seconds.
151
     *
152
     * @return float
153
     */
154
    public function getDuration(): float
155
    {
156
        return $this->duration;
157
    }
158
159
    /**
160
     * Set datetime of suite.
161
     *
162
     * @param DateTime $datetime Datetime of suite.
163
     *
164
     * @return SuiteDTO
165
     */
166
    public function setDatetime(DateTime $datetime): SuiteDTO
167
    {
168
        $this->datetime = $datetime;
169
170
        return $this;
171
    }
172
173
    /**
174
     * Get datetime of suite.
175
     *
176
     * @return DateTime
177
     */
178
    public function getDatetime(): ?DateTime
179
    {
180
        return $this->datetime;
181
    }
182
}
183