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 RequestingCircleMemberEvent |
40
|
|
|
* |
41
|
|
|
* This event is called when one or multiple members are requesting/invited to a Circle. |
42
|
|
|
* This event is called on every instance of Nextcloud related to the Circle. |
43
|
|
|
* |
44
|
|
|
* The entry is already generated in the members table. |
45
|
|
|
* |
46
|
|
|
* This is a good place if anything needs to be executed when a member requests or is invited to a Circle. |
47
|
|
|
* |
48
|
|
|
* If anything needs to be managed on the master instance of the Circle (ie. CircleMemberRequestedEvent), please use: |
49
|
|
|
* $event->getFederatedEvent()->addResult(string $key, array $data); |
50
|
|
|
* |
51
|
|
|
* @package OCA\Circles\Events |
52
|
|
|
*/ |
53
|
|
View Code Duplication |
class RequestingCircleMemberEvent extends CircleMemberGenericEvent { |
|
|
|
|
54
|
|
|
|
55
|
|
|
|
56
|
|
|
/** @var int */ |
57
|
|
|
private $type = 0; |
58
|
|
|
|
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* RequestingCircleMemberEvent constructor. |
62
|
|
|
* |
63
|
|
|
* @param FederatedEvent $federatedEvent |
64
|
|
|
*/ |
65
|
|
|
public function __construct(FederatedEvent $federatedEvent) { |
66
|
|
|
parent::__construct($federatedEvent); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @param int $type |
72
|
|
|
* |
73
|
|
|
* @return $this |
74
|
|
|
*/ |
75
|
|
|
public function setType(int $type): self { |
76
|
|
|
$this->type = $type; |
77
|
|
|
|
78
|
|
|
return $this; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @return int |
83
|
|
|
*/ |
84
|
|
|
public function getType(): int { |
85
|
|
|
return $this->type; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.