Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
9 / 9 |
|
100.00% |
6 / 6 |
CRAP | |
100.00% |
1 / 1 |
StuckTask | |
100.00% |
9 / 9 |
|
100.00% |
6 / 6 |
6 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
getTaskLog | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getTask | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getTaskId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
isOrphan | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getQueueName | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
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) 2021 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); |
19 | */ |
20 | |
21 | declare(strict_types=1); |
22 | |
23 | namespace oat\taoTaskQueue\model; |
24 | |
25 | use oat\tao\model\taskQueue\Task\TaskInterface; |
26 | use oat\tao\model\taskQueue\TaskLog\Entity\EntityInterface; |
27 | |
28 | class StuckTask |
29 | { |
30 | /** @var EntityInterface */ |
31 | private $taskLog; |
32 | |
33 | /** @var string */ |
34 | private $queueName; |
35 | |
36 | /** @var TaskInterface|null */ |
37 | private $task; |
38 | |
39 | /** @var string|null */ |
40 | private $taskId; |
41 | |
42 | public function __construct( |
43 | EntityInterface $taskLog, |
44 | string $queueName, |
45 | TaskInterface $task = null, |
46 | string $taskId = null |
47 | ) { |
48 | $this->taskLog = $taskLog; |
49 | $this->queueName = $queueName; |
50 | $this->task = $task; |
51 | $this->taskId = $taskId; |
52 | } |
53 | |
54 | public function getTaskLog(): EntityInterface |
55 | { |
56 | return $this->taskLog; |
57 | } |
58 | |
59 | public function getTask(): ?TaskInterface |
60 | { |
61 | return $this->task; |
62 | } |
63 | |
64 | public function getTaskId(): ?string |
65 | { |
66 | return $this->taskId; |
67 | } |
68 | |
69 | public function isOrphan(): bool |
70 | { |
71 | return !$this->task; |
72 | } |
73 | |
74 | public function getQueueName(): string |
75 | { |
76 | return $this->queueName; |
77 | } |
78 | } |