|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
/** |
|
5
|
|
|
* @copyright Copyright (c) 2020, Roeland Jago Douma <[email protected]> |
|
6
|
|
|
* |
|
7
|
|
|
* @author Roeland Jago Douma <[email protected]> |
|
8
|
|
|
* |
|
9
|
|
|
* @license GNU AGPL version 3 or any later version |
|
10
|
|
|
* |
|
11
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
12
|
|
|
* it under the terms of the GNU Affero General Public License as |
|
13
|
|
|
* published by the Free Software Foundation, either version 3 of the |
|
14
|
|
|
* License, or (at your option) any later version. |
|
15
|
|
|
* |
|
16
|
|
|
* This program is distributed in the hope that it will be useful, |
|
17
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
18
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
19
|
|
|
* GNU Affero General Public License for more details. |
|
20
|
|
|
* |
|
21
|
|
|
* You should have received a copy of the GNU Affero General Public License |
|
22
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
23
|
|
|
* |
|
24
|
|
|
*/ |
|
25
|
|
|
|
|
26
|
|
|
namespace OC\EventDispatcher; |
|
27
|
|
|
|
|
28
|
|
|
use OCP\ILogger; |
|
29
|
|
|
use Symfony\Component\EventDispatcher\GenericEvent; |
|
30
|
|
|
|
|
31
|
|
|
class GenericEventWrapper extends GenericEvent { |
|
32
|
|
|
|
|
33
|
|
|
/** @var ILogger */ |
|
34
|
|
|
private $logger; |
|
35
|
|
|
|
|
36
|
|
|
/** @var GenericEvent */ |
|
37
|
|
|
private $event; |
|
38
|
|
|
|
|
39
|
|
|
/** @var string */ |
|
40
|
|
|
private $eventName; |
|
41
|
|
|
|
|
42
|
|
|
public function __construct(ILogger $logger, string $eventName, ?GenericEvent $event) { |
|
43
|
|
|
$this->logger = $logger; |
|
44
|
|
|
$this->event = $event; |
|
45
|
|
|
$this->eventName = $eventName; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
private function log() { |
|
49
|
|
|
$this->logger->info( |
|
50
|
|
|
'Deprecated event type for {name}: {class} is used', |
|
51
|
|
|
[ 'name' => $this->eventName, 'class' => is_object($this->event) ? get_class($this->event) : 'null' ] |
|
52
|
|
|
); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
public function isPropagationStopped() { |
|
56
|
|
|
$this->log(); |
|
57
|
|
|
return $this->event->isPropagationStopped(); |
|
|
|
|
|
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
public function stopPropagation() { |
|
61
|
|
|
$this->log(); |
|
62
|
|
|
$this->event->stopPropagation(); |
|
|
|
|
|
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
public function getSubject() { |
|
66
|
|
|
$this->log(); |
|
67
|
|
|
return $this->event->getSubject(); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
public function getArgument($key) { |
|
71
|
|
|
$this->log(); |
|
72
|
|
|
return $this->event->getArgument($key); |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
public function setArgument($key, $value) { |
|
76
|
|
|
$this->log(); |
|
77
|
|
|
return $this->event->setArgument($key, $value); |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
public function getArguments() { |
|
81
|
|
|
return $this->event->getArguments(); |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
public function setArguments(array $args = []) { |
|
85
|
|
|
return $this->event->setArguments($args); |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
public function hasArgument($key) { |
|
89
|
|
|
return $this->event->hasArgument($key); |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
public function offsetGet($key) { |
|
93
|
|
|
return $this->event->offsetGet($key); |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
public function offsetSet($key, $value) { |
|
97
|
|
|
return $this->event->offsetSet($key, $value); |
|
|
|
|
|
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
public function offsetUnset($key) { |
|
101
|
|
|
return $this->event->offsetUnset($key); |
|
|
|
|
|
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
public function offsetExists($key) { |
|
105
|
|
|
return $this->event->offsetExists($key); |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
public function getIterator() { |
|
109
|
|
|
return$this->event->getIterator(); |
|
110
|
|
|
} |
|
111
|
|
|
} |
|
112
|
|
|
|
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.