Passed
Push — master ( 2dd807...470cd2 )
by Jan
04:52
created

SecurityEvent::getTargetUser()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
/**
3
 * This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
4
 *
5
 * Copyright (C) 2019 - 2020 Jan Böhmer (https://github.com/jbtronics)
6
 *
7
 * This program is free software: you can redistribute it and/or modify
8
 * it under the terms of the GNU Affero General Public License as published
9
 * by the Free Software Foundation, either version 3 of the License, or
10
 * (at your option) any later version.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 * GNU Affero General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Affero General Public License
18
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
19
 */
20
21
namespace App\Events;
22
23
24
use App\Entity\UserSystem\User;
25
use Symfony\Contracts\EventDispatcher\Event;
26
27
/**
28
 * This event is triggered when something security related to a user happens.
29
 * For example when the password is reset or the an two factor authentication method was disabled.
30
 * @package App\Events
31
 */
32
class SecurityEvent extends Event
33
{
34
    protected $targetUser;
35
    protected $from_cli;
36
37
    public function __construct(User $targetUser)
38
    {
39
        $this->targetUser = $targetUser;
40
    }
41
42
    /**
43
     * Returns the affected user.
44
     * @return User
45
     */
46
    public function getTargetUser()
47
    {
48
        return $this->targetUser;
49
    }
50
}