Completed
Pull Request — master (#32767)
by Sujith
61:42 queued 48:53
created

UserPasswordCreateEvent   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 50
rs 10
c 0
b 0
f 0
wmc 6
lcom 1
cbo 1

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getEvent() 0 3 1
A getData() 0 3 1
A setPassword() 0 3 1
A getPassword() 0 6 2
1
<?php
2
/**
3
 * @author Sujith Haridasan <[email protected]>
4
 *
5
 * @copyright Copyright (c) 2018, ownCloud GmbH
6
 * @license AGPL-3.0
7
 *
8
 * This code is free software: you can redistribute it and/or modify
9
 * it under the terms of the GNU Affero General Public License, version 3,
10
 * as published by the Free Software Foundation.
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, version 3,
18
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
19
 *
20
 */
21
22
namespace OCP\User;
23
24
use Symfony\Component\EventDispatcher\Event;
25
26
class UserPasswordCreateEvent extends Event {
27
	const CREATE_PASSWORD = 'OCP\User::createPassword';
28
29
	/** @var string event name */
30
	protected $event;
31
	/** @var array data*/
32
	protected $data;
33
34
	/**
35
	 * UserPasswordCreateEvent constructor.
36
	 *
37
	 * @param string $event
38
	 * @param array $data
39
	 */
40
	public function __construct($event, $data = []) {
41
		$this->event = $event;
42
		$this->data = $data;
43
	}
44
45
	/**
46
	 * @return string
47
	 */
48
	public function getEvent() {
49
		return $this->event;
50
	}
51
52
	/**
53
	 * @return array
54
	 */
55
	public function getData() {
56
		return $this->data;
57
	}
58
59
	/**
60
	 * @param string $password
61
	 */
62
	public function setPassword($password) {
63
		$this->data['password'] = $password;
64
	}
65
66
	/**
67
	 * @return bool|mixed
68
	 */
69
	public function getPassword() {
70
		if (isset($this->data['password'])) {
71
			return $this->data['password'];
72
		}
73
		return false;
74
	}
75
}