Completed
Push — master ( 6247cb...136da8 )
by Maxence
19s queued 11s
created

EditingCircleMemberEvent::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
6
/**
7
 * Circles - Bring cloud-users closer together.
8
 *
9
 * This file is licensed under the Affero General Public License version 3 or
10
 * later. See the COPYING file.
11
 *
12
 * @author Maxence Lange <[email protected]>
13
 * @copyright 2021
14
 * @license GNU AGPL version 3 or any later version
15
 *
16
 * This program is free software: you can redistribute it and/or modify
17
 * it under the terms of the GNU Affero General Public License as
18
 * published by the Free Software Foundation, either version 3 of the
19
 * License, or (at your option) any later version.
20
 *
21
 * This program is distributed in the hope that it will be useful,
22
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24
 * GNU Affero General Public License for more details.
25
 *
26
 * You should have received a copy of the GNU Affero General Public License
27
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
28
 *
29
 */
30
31
32
namespace OCA\Circles\Events;
33
34
35
use OCA\Circles\Model\Federated\FederatedEvent;
36
37
38
/**
39
 * Class EditingCircleMemberEvent
40
 *
41
 * This event is called when a member is edited.
42
 * This event is called on every instance of Nextcloud related to the Circle.
43
 *
44
 * The entry is already edited in the members table.
45
 * If needed, the entries in the memberships table are already edited.
46
 *
47
 * This is a good place if anything needs to be executed when a member is edited.
48
 *
49
 * If anything needs to be managed on the master instance of the Circle (ie. CircleMemberEditedEvent), please
50
 * use:
51
 *    $event->getFederatedEvent()->addResult(string $key, array $data);
52
 *
53
 * @package OCA\Circles\Events
54
 */
55
class EditingCircleMemberEvent extends CircleMemberGenericEvent {
56
57
58
	/** @var int */
59
	private $type = 0;
60
61
	/** @var int */
62
	private $level = 0;
63
64
	/** @var string */
65
	private $displayName = '';
66
67
68
	/**
69
	 * EditingCircleMemberEvent constructor.
70
	 *
71
	 * @param FederatedEvent $federatedEvent
72
	 */
73
	public function __construct(FederatedEvent $federatedEvent) {
74
		parent::__construct($federatedEvent);
75
	}
76
77
78
	/**
79
	 * @param int $type
80
	 *
81
	 * @return $this
82
	 */
83
	public function setType(int $type): self {
84
		$this->type = $type;
85
86
		return $this;
87
	}
88
89
	/**
90
	 * @return int
91
	 */
92
	public function getType(): int {
93
		return $this->type;
94
	}
95
96
97
	/**
98
	 * @param int $level
99
	 *
100
	 * @return EditingCircleMemberEvent
101
	 */
102
	public function setLevel(int $level): self {
103
		$this->level = $level;
104
105
		return $this;
106
	}
107
108
	/**
109
	 * @return int
110
	 */
111
	public function getLevel(): int {
112
		return $this->level;
113
	}
114
115
116
	/**
117
	 * @param string $displayName
118
	 *
119
	 * @return EditingCircleMemberEvent
120
	 */
121
	public function setDisplayName(string $displayName): self {
122
		$this->displayName = $displayName;
123
124
		return $this;
125
	}
126
127
	/**
128
	 * @return string
129
	 */
130
	public function getDisplayName(): string {
131
		return $this->displayName;
132
	}
133
134
135
}
136
137