This repository has been archived by the owner on Apr 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Mixin.php
237 lines (203 loc) · 5.79 KB
/
Mixin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
<?php
declare(strict_types = 1);
namespace BetterWpHooks;
use BetterWpHooks\Dispatchers\WordpressDispatcher;
use BetterWpHooks\Exceptions\DuplicateListenerException;
use BetterWpHooks\Testing\FakeDispatcher;
use Closure;
use Contracts\ContainerAdapter;
use Exception;
use ReflectionException;
/**
* @codeCoverageIgnore
*
* Can be applied to a class via a "@mixin" annotation for better IDE support.
* This class is not meant to be used in any other capacity.
*/
final class Mixin
{
/**
* Prevent class instantiation.
*/
private function __construct()
{
}
/**
* Returns the Ioc Container Instance
*/
public static function container() : ContainerAdapter
{
}
/**
*
* Registers an array of listeners with the dispatcher instance
* The provided array has to be an associative of triggers and listeners.
*
* @param array $listeners
*/
public static function listeners(array $listeners)
{
}
/**
* Accepts an array of key value pairs where the key is the
* name of a wordpress defined hook and the value is the full
* class name of an event object.
*
* @param array $mapped_events
*/
public static function map(array $mapped_events)
{
}
/**
* Bootstraps the instance of BetterWpHooks
* and registers all provided listeners
*/
public static function boot()
{
}
/**
* Returns the dispatcher instance
*
* @return WordpressDispatcher|FakeDispatcher
*/
public static function dispatcher()
{
}
/**
* Register an event listener with the dispatcher.
*
* @param string $event
* @param string|array|Closure|callable|object $callable
*
* @return void
* @throws Exception
*/
public static function listen(string $event, $callable) : void
{
}
/**
* Register an event listener with the dispatcher that
* can not be removed.
*
* @param string $event
* @param string|array|Closure|callable|object $callable
*
* @return void
*/
public static function unremovable(string $event, $callable)
{
}
/**
*
* Create an event object that will always run first no matter what other hooks are
* registered with WordPress.
*
* @param array $mapped_events A multi-dimensional array where each element has the following format
*
* 'init' => [
* EventObject::class
* ]
*
* @return BetterWpHooks
*/
public static function ensureFirst(array $mapped_events) : BetterWpHooks
{
}
/**
*
* Create an event object that will always run last no matter what other hooks are
* registered with WordPress.
*
* @param array $mapped_events A multi-dimensional array where each element has the following format
*
* 'init' => [
* EventObject::class
* ]
*
* @return BetterWpHooks
*
*/
public static function ensureLast(array $mapped_events) :BetterWpHooks
{
}
/** Checks if an Event has any registered callbacks.
*
* @param string $eventName
*
* @return bool
*/
public static function hasListeners(string $eventName) : bool
{
}
/**
*
* Check if a specific listener was created through the WordpressDispatcher
*
* @param object|string|Closure $listener
* @param string|object $event
*
* @return bool
*/
public static function hasListenerFor($listener, $event) : bool
{
}
/** Remove one listener for a given event from the dispatcher.
*
* @param string $event
* @param string|object|array $listener
*
* @return void
*/
public static function forgetOne(string $event, $listener) : void
{
}
/** Remove all listeners for the event
*
* @param string $event
*
* @return void
*/
public static function forget(string $event) : void
{
}
/**
* Assert if an event was dispatched based on a truth-test callback.
*
* @param string|Closure $event
* @param callable|int|null $callback
*
* @return void
*/
public static function assertDispatched($event, $callback = null) : void
{
}
/**
* Assert if an event was dispatched a number of times.
*
* @param string $event
* @param int $times
*
*/
public static function assertDispatchedTimes(string $event, int $times = 1) : bool
{
}
/**
* Determine if an event was dispatched based on a truth-test callback.
*
* @param string|Closure $event
* @param callable|null $callback
*
* @return void
*/
public static function assertNotDispatched($event, callable $callback = null) : void
{
}
/**
* Assert that no events were dispatched.
*
* @return void
*/
public static function assertNothingDispatched() : void
{
}
}