Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
64.71% |
11 / 17 |
|
71.43% |
5 / 7 |
CRAP | |
0.00% |
0 / 1 |
TasksLogsStats | |
64.71% |
11 / 17 |
|
71.43% |
5 / 7 |
9.15 | |
0.00% |
0 / 1 |
__construct | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
buildFromArray | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
getNumberOfTasksCompleted | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getNumberOfTasksFailed | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getNumberOfTasksInProgress | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
jsonSerialize | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |||
toArray | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | /** |
4 | * This program is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU General Public License |
6 | * as published by the Free Software Foundation; under version 2 |
7 | * of the License (non-upgradable). |
8 | * |
9 | * This program is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. |
13 | * |
14 | * You should have received a copy of the GNU General Public License |
15 | * along with this program; if not, write to the Free Software |
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
17 | * |
18 | * Copyright (c) 2017 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); |
19 | * |
20 | */ |
21 | |
22 | namespace oat\taoTaskQueue\model\Entity; |
23 | |
24 | use JsonSerializable; |
25 | |
26 | /** |
27 | * @deprecated Use \oat\tao\model\taskQueue\TaskLog\TasksLogsStats |
28 | */ |
29 | class TasksLogsStats implements JsonSerializable |
30 | { |
31 | public const COMPLETED_TASKS = 'completedtasks'; |
32 | public const FAILED_TASKS = 'failedtasks'; |
33 | public const IN_PROGRESS_TASKS = 'inprogresstasks'; |
34 | |
35 | /** @var int */ |
36 | private $numberOfTasksCompleted; |
37 | |
38 | /** @var int */ |
39 | private $numberOfTasksFailed; |
40 | |
41 | /** @var int */ |
42 | private $numberOfTasksInProgress; |
43 | |
44 | /** |
45 | * TaskLogStatus constructor. |
46 | * @param int $numberOfTasksCompleted |
47 | * @param int $numberOfTasksFailed |
48 | * @param int $numberOfTasksInProgress |
49 | */ |
50 | public function __construct($numberOfTasksCompleted, $numberOfTasksFailed, $numberOfTasksInProgress) |
51 | { |
52 | $this->numberOfTasksCompleted = $numberOfTasksCompleted; |
53 | $this->numberOfTasksFailed = $numberOfTasksFailed; |
54 | $this->numberOfTasksInProgress = $numberOfTasksInProgress; |
55 | } |
56 | |
57 | /** |
58 | * @param array $rawData |
59 | * @return TasksLogsStats |
60 | */ |
61 | public static function buildFromArray(array $rawData) |
62 | { |
63 | return new self( |
64 | $rawData[static::COMPLETED_TASKS], |
65 | $rawData[static::FAILED_TASKS], |
66 | $rawData[static::IN_PROGRESS_TASKS] |
67 | ); |
68 | } |
69 | |
70 | /** |
71 | * @return int |
72 | */ |
73 | public function getNumberOfTasksCompleted() |
74 | { |
75 | return $this->numberOfTasksCompleted; |
76 | } |
77 | |
78 | /** |
79 | * @return int |
80 | */ |
81 | public function getNumberOfTasksFailed() |
82 | { |
83 | return $this->numberOfTasksFailed; |
84 | } |
85 | |
86 | /** |
87 | * @return int |
88 | */ |
89 | public function getNumberOfTasksInProgress() |
90 | { |
91 | return $this->numberOfTasksInProgress; |
92 | } |
93 | |
94 | /** |
95 | * @inheritdoc |
96 | */ |
97 | public function jsonSerialize() |
98 | { |
99 | return [ |
100 | 'numberOfTasksCompleted' => $this->numberOfTasksCompleted, |
101 | 'numberOfTasksFailed' => $this->numberOfTasksFailed, |
102 | 'numberOfTasksInProgress' => $this->numberOfTasksInProgress, |
103 | ]; |
104 | } |
105 | |
106 | /** |
107 | * @return array |
108 | */ |
109 | public function toArray() |
110 | { |
111 | return $this->jsonSerialize(); |
112 | } |
113 | } |