1 | <?php |
||
5 | class ImportRun |
||
6 | { |
||
7 | const STATE_REVOKED = 'revoked'; |
||
8 | const STATE_FINISHED = 'finished'; |
||
9 | const STATE_CREATED = 'created'; |
||
10 | const STATE_VALIDATED = 'validated'; |
||
11 | |||
12 | protected $id; |
||
13 | |||
14 | /** |
||
15 | * @var ImportConfiguration |
||
16 | */ |
||
17 | protected $configuration; |
||
18 | |||
19 | /** |
||
20 | * @var \DateTime |
||
21 | */ |
||
22 | protected $createdAt; |
||
23 | protected $createdBy; |
||
24 | |||
25 | /** |
||
26 | * @var \DateTime |
||
27 | */ |
||
28 | protected $validatedAt; |
||
29 | protected $validationMessages; |
||
30 | |||
31 | /** |
||
32 | * @var \DateTime |
||
33 | */ |
||
34 | protected $finishedAt; |
||
35 | |||
36 | /** |
||
37 | * @var \DateTime |
||
38 | */ |
||
39 | protected $revokedAt; |
||
40 | protected $revokedBy; |
||
41 | |||
42 | protected $statistics = array(); |
||
43 | protected $info = array(); |
||
44 | |||
45 | /** |
||
46 | * arbitrary data. |
||
47 | */ |
||
48 | protected $context; |
||
49 | |||
50 | 29 | public function __construct(ImportConfiguration $configuration = null, $createdBy = null) |
|
57 | |||
58 | /** |
||
59 | * @return ImportRun |
||
60 | */ |
||
61 | public static function create(ImportConfiguration $configuration = null, $createdBy = null) |
||
65 | |||
66 | /** |
||
67 | * @return ImportRun |
||
68 | */ |
||
69 | 2 | public function setContext($context) |
|
80 | |||
81 | 6 | public function getContext() |
|
85 | |||
86 | 2 | public function getId() |
|
90 | |||
91 | 1 | public function getCreatedBy() |
|
95 | |||
96 | /** |
||
97 | * @return ImportRun |
||
98 | */ |
||
99 | 1 | public function revoke($revokedBy = null) |
|
110 | |||
111 | /** |
||
112 | * @return ImportRun |
||
113 | */ |
||
114 | 1 | public function reset() |
|
120 | |||
121 | 4 | public function isRevoked() |
|
125 | |||
126 | /** |
||
127 | * @return ImportRun |
||
128 | */ |
||
129 | 14 | public function finish() |
|
135 | |||
136 | 5 | public function isFinished() |
|
140 | |||
141 | /** |
||
142 | * @return ImportRun |
||
143 | */ |
||
144 | 1 | public function validated(array $validationMessages = null) |
|
151 | |||
152 | 1 | public function getValidationMessages() |
|
156 | |||
157 | 1 | public function isValidated() |
|
161 | |||
162 | 5 | public function isRunnable() |
|
166 | |||
167 | /** |
||
168 | * @return ImportConfiguration |
||
169 | */ |
||
170 | 1 | public function getConfiguration() |
|
174 | |||
175 | /** |
||
176 | * @return ImportRun |
||
177 | */ |
||
178 | 14 | public function setStatistics(array $statistics) |
|
184 | |||
185 | 2 | public function getStatistics() |
|
189 | |||
190 | /** |
||
191 | * @return ImportRun |
||
192 | */ |
||
193 | 2 | public function setInfo(array $info) |
|
199 | |||
200 | 1 | public function getInfo() |
|
204 | |||
205 | 17 | public function getState() |
|
209 | |||
210 | 17 | public static function timestampsToState($revokedAt, $finishedAt, $validatedAt) |
|
224 | |||
225 | 12 | public function toArray() |
|
239 | } |
||
240 |