UserDeletedListener   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A handle() 0 8 2
1
<?php
2
/**
3
 * Analytics
4
 *
5
 * SPDX-FileCopyrightText: 2019-2022 Marcel Scherello
6
 * SPDX-License-Identifier: AGPL-3.0-or-later
7
 */
8
9
declare(strict_types=1);
10
11
namespace OCA\Analytics\Listener;
12
13
use OCP\EventDispatcher\Event;
0 ignored issues
show
Bug introduced by
The type OCP\EventDispatcher\Event was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
use OCP\EventDispatcher\IEventListener;
0 ignored issues
show
Bug introduced by
The type OCP\EventDispatcher\IEventListener was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
use OCP\User\Events\UserDeletedEvent;
0 ignored issues
show
Bug introduced by
The type OCP\User\Events\UserDeletedEvent was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
use OCA\Analytics\Service\UserService;
17
18
class UserDeletedListener implements IEventListener
19
{
20
21
    /** @var UserService */
22
    private $service;
23
24
    public function __construct(UserService $service) {
25
        $this->service = $service;
26
    }
27
    public function handle(Event $event): void
28
    {
29
        if(!$event instanceof UserDeletedEvent) {
30
            return;
31
        }
32
33
        $uid = $event->getUser()->getUID();
34
        $this->service->deleteUserData($uid);
35
    }
36
}