Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
22.22% covered (danger)
22.22%
2 / 9
20.00% covered (danger)
20.00%
1 / 5
CRAP
0.00% covered (danger)
0.00%
0 / 1
DacRootChangedEvent
22.22% covered (danger)
22.22%
2 / 9
20.00% covered (danger)
20.00%
1 / 5
16.76
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getResource
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getPermissionsDelta
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getName
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 jsonSerialize
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
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) 2023 (original work) Open Assessment Technologies SA.
19 */
20
21declare(strict_types=1);
22
23namespace oat\taoDacSimple\model\event;
24
25use core_kernel_classes_Resource;
26use JsonSerializable;
27use oat\oatbox\event\Event;
28
29class DacRootChangedEvent implements Event, JsonSerializable
30{
31    private core_kernel_classes_Resource $resource;
32    private array $permissionsDelta;
33
34    public function __construct(core_kernel_classes_Resource $resource, array $permissionsDelta)
35    {
36        $this->resource = $resource;
37        $this->permissionsDelta = $permissionsDelta;
38    }
39
40    public function getResource(): core_kernel_classes_Resource
41    {
42        return $this->resource;
43    }
44
45    public function getPermissionsDelta(): array
46    {
47        return $this->permissionsDelta;
48    }
49
50    public function getName(): string
51    {
52        return __CLASS__;
53    }
54
55    public function jsonSerialize(): array
56    {
57        return [
58            'resourceUri' => $this->getResource()->getUri(),
59            'permissionsDelta' => $this->permissionsDelta,
60        ];
61    }
62}