|
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
|
|
|
* Campaign 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 CampaignDTO |
|
40
|
|
|
{ |
|
41
|
|
|
/** |
|
42
|
|
|
* Tests warning limit. Integer between 0 and 100 %. Warning limit of 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
|
|
|
private $warning; |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* Tests success limit. Integer between 0 and 100 %. Success limit of 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
|
|
|
private $success; |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* Start Date time of the campaign in format (2017-07-01 12:30:01). Now by default. |
|
67
|
|
|
* |
|
68
|
|
|
* @var DateTime |
|
69
|
|
|
* |
|
70
|
|
|
* @Type("DateTime<'Y-m-d H:i:s'>") |
|
71
|
|
|
* |
|
72
|
|
|
* @Assert\DateTime() |
|
73
|
|
|
*/ |
|
74
|
|
|
private $start; |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* End Date time of the campaign in format (2017-07-01 12:30:01). Null by default. |
|
78
|
|
|
* |
|
79
|
|
|
* @var DateTime |
|
80
|
|
|
* |
|
81
|
|
|
* @Type("DateTime<'Y-m-d H:i:s'>") |
|
82
|
|
|
* |
|
83
|
|
|
* @Assert\DateTime() |
|
84
|
|
|
*/ |
|
85
|
|
|
private $end; |
|
86
|
|
|
|
|
87
|
|
|
/** |
|
88
|
|
|
* Set warning limit. |
|
89
|
|
|
* |
|
90
|
|
|
* @param int $warning |
|
91
|
|
|
* |
|
92
|
|
|
* @return CampaignDTO |
|
93
|
|
|
*/ |
|
94
|
|
|
public function setWarning(int $warning): CampaignDTO |
|
95
|
|
|
{ |
|
96
|
|
|
$this->warning = $warning; |
|
97
|
|
|
|
|
98
|
|
|
return $this; |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
/** |
|
102
|
|
|
* Get warning limit. |
|
103
|
|
|
* |
|
104
|
|
|
* @return int |
|
105
|
|
|
*/ |
|
106
|
|
|
public function getWarning(): ?int |
|
107
|
|
|
{ |
|
108
|
|
|
return $this->warning; |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
|
|
/** |
|
112
|
|
|
* Set success limit. |
|
113
|
|
|
* |
|
114
|
|
|
* @param int $success |
|
115
|
|
|
* |
|
116
|
|
|
* @return CampaignDTO |
|
117
|
|
|
*/ |
|
118
|
|
|
public function setSuccess(int $success): CampaignDTO |
|
119
|
|
|
{ |
|
120
|
|
|
$this->success = $success; |
|
121
|
|
|
|
|
122
|
|
|
return $this; |
|
123
|
|
|
} |
|
124
|
|
|
|
|
125
|
|
|
/** |
|
126
|
|
|
* Get success limit. |
|
127
|
|
|
* |
|
128
|
|
|
* @return int |
|
129
|
|
|
*/ |
|
130
|
|
|
public function getSuccess(): ?int |
|
131
|
|
|
{ |
|
132
|
|
|
return $this->success; |
|
133
|
|
|
} |
|
134
|
|
|
|
|
135
|
|
|
/** |
|
136
|
|
|
* Set start datetime of campaign. |
|
137
|
|
|
* |
|
138
|
|
|
* @param DateTime $datetime start datetime of campaign. |
|
139
|
|
|
* |
|
140
|
|
|
* @return CampaignDTO |
|
141
|
|
|
*/ |
|
142
|
|
|
public function setStart(DateTime $datetime): CampaignDTO |
|
143
|
|
|
{ |
|
144
|
|
|
$this->start = $datetime; |
|
145
|
|
|
|
|
146
|
|
|
return $this; |
|
147
|
|
|
} |
|
148
|
|
|
|
|
149
|
|
|
/** |
|
150
|
|
|
* Get start datetime of campaign. |
|
151
|
|
|
* |
|
152
|
|
|
* @return DateTime |
|
153
|
|
|
*/ |
|
154
|
|
|
public function getStart(): ?DateTime |
|
155
|
|
|
{ |
|
156
|
|
|
return $this->start; |
|
157
|
|
|
} |
|
158
|
|
|
|
|
159
|
|
|
/** |
|
160
|
|
|
* Set end datetime of campaign. |
|
161
|
|
|
* |
|
162
|
|
|
* @param DateTime $datetime end datetime of campaign. |
|
163
|
|
|
* |
|
164
|
|
|
* @return CampaignDTO |
|
165
|
|
|
*/ |
|
166
|
|
|
public function setEnd(DateTime $datetime): CampaignDTO |
|
167
|
|
|
{ |
|
168
|
|
|
$this->end = $datetime; |
|
169
|
|
|
|
|
170
|
|
|
return $this; |
|
171
|
|
|
} |
|
172
|
|
|
|
|
173
|
|
|
/** |
|
174
|
|
|
* Get end datetime of campaign. |
|
175
|
|
|
* |
|
176
|
|
|
* @return DateTime |
|
177
|
|
|
*/ |
|
178
|
|
|
public function getEnd(): ?DateTime |
|
179
|
|
|
{ |
|
180
|
|
|
return $this->end; |
|
181
|
|
|
} |
|
182
|
|
|
} |
|
183
|
|
|
|