UserLoggedInEvent   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 50
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getUser() 0 2 1
A isTokenLogin() 0 2 1
A __construct() 0 6 1
A getLoginName() 0 2 1
A getPassword() 0 2 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * @copyright Copyright (c) 2019, Roeland Jago Douma <[email protected]>
7
 *
8
 * @author Christoph Wurst <[email protected]>
9
 * @author Joas Schilling <[email protected]>
10
 *
11
 * @license GNU AGPL version 3 or any later version
12
 *
13
 * This program is free software: you can redistribute it and/or modify
14
 * it under the terms of the GNU Affero General Public License as
15
 * published by the Free Software Foundation, either version 3 of the
16
 * License, or (at your option) any later version.
17
 *
18
 * This program is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
 * GNU Affero General Public License for more details.
22
 *
23
 * You should have received a copy of the GNU Affero General Public License
24
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25
 *
26
 */
27
namespace OCP\User\Events;
28
29
use OCP\EventDispatcher\Event;
30
use OCP\IUser;
31
32
/**
33
 * @since 18.0.0
34
 */
35
class UserLoggedInEvent extends Event {
36
	/** @var IUser */
37
	private $user;
38
39
	/** @var string|null */
40
	private $password;
41
42
	/** @var bool */
43
	private $isTokenLogin;
44
45
	/** @var string */
46
	private $loginName;
47
48
	/**
49
	 * @since 18.0.0
50
	 */
51
	public function __construct(IUser $user, string $loginName, ?string $password, bool $isTokenLogin) {
52
		parent::__construct();
53
		$this->user = $user;
54
		$this->password = $password;
55
		$this->isTokenLogin = $isTokenLogin;
56
		$this->loginName = $loginName;
57
	}
58
59
	/**
60
	 * @since 18.0.0
61
	 */
62
	public function getUser(): IUser {
63
		return $this->user;
64
	}
65
66
	/**
67
	 * @since 21.0.0
68
	 */
69
	public function getLoginName(): string {
70
		return $this->loginName;
71
	}
72
73
	/**
74
	 * @since 18.0.0
75
	 */
76
	public function getPassword(): ?string {
77
		return $this->password;
78
	}
79
80
	/**
81
	 * @since 18.0.0
82
	 */
83
	public function isTokenLogin(): bool {
84
		return $this->isTokenLogin;
85
	}
86
}
87