Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
7 / 7 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
ItemRemovedEvent | |
100.00% |
7 / 7 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
getName | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
jsonSerialize | |
100.00% |
4 / 4 |
|
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) 2016-2023 (original work) Open Assessment Technologies SA. |
19 | */ |
20 | |
21 | namespace oat\taoItems\model\event; |
22 | |
23 | use oat\oatbox\event\Event; |
24 | use JsonSerializable; |
25 | |
26 | class ItemRemovedEvent implements Event, JsonSerializable |
27 | { |
28 | public const PAYLOAD_KEY_DELETE_RELATED_ASSETS = 'deleteRelatedAssets'; |
29 | public const PAYLOAD_KEY_ITEM_URI = 'itemUri'; |
30 | |
31 | protected string $itemUri; |
32 | |
33 | private array $payload; |
34 | |
35 | public function __construct(string $itemUri, array $payload = []) |
36 | { |
37 | $this->itemUri = $itemUri; |
38 | $this->payload = $payload; |
39 | } |
40 | |
41 | public function getName() |
42 | { |
43 | return get_class($this); |
44 | } |
45 | |
46 | public function jsonSerialize() |
47 | { |
48 | return array_merge( |
49 | [self::PAYLOAD_KEY_ITEM_URI => $this->itemUri], |
50 | $this->payload |
51 | ); |
52 | } |
53 | } |