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 daita\MySmallPhpTools\Model\SimpleDataStore; |
36
|
|
|
use OCA\Circles\Model\Circle; |
37
|
|
|
use OCA\Circles\Model\Federated\FederatedEvent; |
38
|
|
|
use OCA\Circles\Model\Member; |
39
|
|
|
use OCP\EventDispatcher\Event; |
40
|
|
|
|
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Class CircleResultGenericEvent |
44
|
|
|
* |
45
|
|
|
* @package OCA\Circles\Events |
46
|
|
|
*/ |
47
|
|
|
class CircleResultGenericEvent extends Event { |
48
|
|
|
|
49
|
|
|
|
50
|
|
|
/** @var FederatedEvent */ |
51
|
|
|
private $federatedEvent; |
52
|
|
|
|
53
|
|
|
/** @var SimpleDataStore[] */ |
54
|
|
|
private $results; |
55
|
|
|
|
56
|
|
|
/** @var Circle */ |
57
|
|
|
private $circle; |
58
|
|
|
|
59
|
|
|
/** @var Member */ |
60
|
|
|
private $member; |
61
|
|
|
|
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* CircleResultGenericEvent constructor. |
65
|
|
|
* |
66
|
|
|
* @param FederatedEvent $federatedEvent |
67
|
|
|
* @param SimpleDataStore[] $results |
68
|
|
|
*/ |
69
|
|
|
public function __construct(FederatedEvent $federatedEvent, array $results) { |
70
|
|
|
parent::__construct(); |
71
|
|
|
|
72
|
|
|
$this->federatedEvent = $federatedEvent; |
73
|
|
|
$this->results = $results; |
74
|
|
|
|
75
|
|
|
$this->circle = $federatedEvent->getCircle(); |
76
|
|
|
if ($federatedEvent->hasMember()) { |
77
|
|
|
$this->member = $federatedEvent->getMember(); |
78
|
|
|
} |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @return FederatedEvent |
84
|
|
|
*/ |
85
|
|
|
public function getFederatedEvent(): FederatedEvent { |
86
|
|
|
return $this->federatedEvent; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @return SimpleDataStore[] |
92
|
|
|
*/ |
93
|
|
|
public function getResults(): array { |
94
|
|
|
return $this->results; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* @return Circle |
100
|
|
|
*/ |
101
|
|
|
public function getCircle(): Circle { |
102
|
|
|
return $this->circle; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @return bool |
108
|
|
|
*/ |
109
|
|
|
public function hasMember(): bool { |
110
|
|
|
return (!is_null($this->member)); |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* @return Member|null |
115
|
|
|
*/ |
116
|
|
|
public function getMember(): ?Member { |
117
|
|
|
return $this->member; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
|