PluginProbe
Fluent Support – Helpdesk & Customer Support Ticket System / trunk
Fluent Support – Helpdesk & Customer Support Ticket System vtrunk
2.4.0 2.3.2 2.3.1 2.3.0 2.2.1 2.2.0 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.4.0 1.4.1 1.4.2 1.4.5 1.4.6 1.4.7 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 All 68 releases
fluent-support / vendor / wpfluent / framework / src / WPFluent / Events / NullDispatcher.php

NullDispatcher.php in Fluent Support – Helpdesk & Customer Support Ticket System trunk, at vendor/wpfluent/framework/src/WPFluent/Events/NullDispatcher.php

145 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentSupport\Framework\Events;
4
5 use FluentSupport\Framework\Support\ForwardsCalls;
6 use FluentSupport\Framework\Events\DispatcherInterface;
7
8 class NullDispatcher implements DispatcherInterface
9 {
10 use ForwardsCalls;
11
12 /**
13 * The underlying event dispatcher instance.
14 *
15 * @var \FluentSupport\Framework\Events\DispatcherInterface
16 */
17 protected $dispatcher;
18
19 /**
20 * Create a new event dispatcher instance that does not fire.
21 *
22 * @param \FluentSupport\Framework\Events\DispatcherInterface $dispatcher
23 * @return void
24 */
25 public function __construct(DispatcherInterface $dispatcher)
26 {
27 $this->dispatcher = $dispatcher;
28 }
29
30 /**
31 * Don't fire an event.
32 *
33 * @param string|object $event
34 * @param mixed $payload
35 * @param bool $halt
36 * @return void
37 */
38 public function dispatch($event, $payload = [], $halt = false)
39 {
40 //
41 }
42
43 /**
44 * Don't register an event and payload to be fired later.
45 *
46 * @param string $event
47 * @param array $payload
48 * @return void
49 */
50 public function push($event, $payload = [])
51 {
52 //
53 }
54
55 /**
56 * Don't dispatch an event.
57 *
58 * @param string|object $event
59 * @param mixed $payload
60 * @return array|null
61 */
62 public function until($event, $payload = [])
63 {
64 //
65 }
66
67 /**
68 * Register an event listener with the dispatcher.
69 *
70 * @param \Closure|string|array $events
71 * @param \Closure|string|array|null $listener
72 * @return void
73 */
74 public function listen($events, $listener = null)
75 {
76 $this->dispatcher->listen($events, $listener);
77 }
78
79 /**
80 * Determine if a given event has listeners.
81 *
82 * @param string $eventName
83 * @return bool
84 */
85 public function hasListeners($eventName)
86 {
87 return $this->dispatcher->hasListeners($eventName);
88 }
89
90 /**
91 * Register an event subscriber with the dispatcher.
92 *
93 * @param object|string $subscriber
94 * @return void
95 */
96 public function subscribe($subscriber)
97 {
98 $this->dispatcher->subscribe($subscriber);
99 }
100
101 /**
102 * Flush a set of pushed events.
103 *
104 * @param string $event
105 * @return void
106 */
107 public function flush($event)
108 {
109 $this->dispatcher->flush($event);
110 }
111
112 /**
113 * Remove a set of listeners from the dispatcher.
114 *
115 * @param string $event
116 * @return void
117 */
118 public function forget($event)
119 {
120 $this->dispatcher->forget($event);
121 }
122
123 /**
124 * Forget all of the queued listeners.
125 *
126 * @return void
127 */
128 public function forgetPushed()
129 {
130 $this->dispatcher->forgetPushed();
131 }
132
133 /**
134 * Dynamically pass method calls to the underlying dispatcher.
135 *
136 * @param string $method
137 * @param array $parameters
138 * @return mixed
139 */
140 public function __call($method, $parameters)
141 {
142 return $this->forwardCallTo($this->dispatcher, $method, $parameters);
143 }
144 }
145