| Code Coverage | ||||||||||
| Lines | Functions and Methods | Classes and Traits | ||||||||
| Total |  | 55.56% | 5 / 9 |  | 60.00% | 3 / 5 | CRAP |  | 0.00% | 0 / 1 | 
| UserRemovedEvent |  | 55.56% | 5 / 9 |  | 60.00% | 3 / 5 | 7.19 |  | 0.00% | 0 / 1 | 
| __construct |  | 100.00% | 1 / 1 |  | 100.00% | 1 / 1 | 1 | |||
| getName |  | 0.00% | 0 / 1 |  | 0.00% | 0 / 1 | 2 | |||
| jsonSerialize |  | 0.00% | 0 / 3 |  | 0.00% | 0 / 1 | 2 | |||
| getWebhookEventName |  | 100.00% | 1 / 1 |  | 100.00% | 1 / 1 | 1 | |||
| serializeForWebhook |  | 100.00% | 3 / 3 |  | 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) 2015-2020 (original work) Open Assessment Technologies SA | 
| 19 | * | 
| 20 | */ | 
| 21 | |
| 22 | declare(strict_types=1); | 
| 23 | |
| 24 | namespace oat\tao\model\event; | 
| 25 | |
| 26 | use JsonSerializable; | 
| 27 | use oat\oatbox\event\Event; | 
| 28 | use oat\tao\model\webhooks\WebhookSerializableEventInterface; | 
| 29 | |
| 30 | class UserRemovedEvent implements Event, JsonSerializable, WebhookSerializableEventInterface | 
| 31 | { | 
| 32 | public const EVENT_NAME = __CLASS__; | 
| 33 | |
| 34 | private const WEBHOOK_EVENT_NAME = 'user-removed'; | 
| 35 | |
| 36 | /** @var string */ | 
| 37 | private $userUri; | 
| 38 | |
| 39 | /** | 
| 40 | * @param string $userUri | 
| 41 | */ | 
| 42 | public function __construct($userUri) | 
| 43 | { | 
| 44 | $this->userUri = $userUri; | 
| 45 | } | 
| 46 | |
| 47 | |
| 48 | /** | 
| 49 | * Return a unique name for this event | 
| 50 | * @see \oat\oatbox\event\Event::getName() | 
| 51 | */ | 
| 52 | public function getName() | 
| 53 | { | 
| 54 | return self::EVENT_NAME; | 
| 55 | } | 
| 56 | |
| 57 | public function jsonSerialize(): array | 
| 58 | { | 
| 59 | return [ | 
| 60 | 'uri' => $this->userUri, | 
| 61 | ]; | 
| 62 | } | 
| 63 | |
| 64 | public function getWebhookEventName() | 
| 65 | { | 
| 66 | return self::WEBHOOK_EVENT_NAME; | 
| 67 | } | 
| 68 | |
| 69 | public function serializeForWebhook() | 
| 70 | { | 
| 71 | return [ | 
| 72 | 'userId' => $this->userUri, | 
| 73 | ]; | 
| 74 | } | 
| 75 | } |