PluginProbe
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification / 5.5.0
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification v5.5.0
5.5.0 5.4.0 5.3.2 5.3.1 5.1.6 5.1.5 trunk 2.1.5 2.11 2.12 2.13 2.15 3.0.0 3.0.1 3.0.2 3.0.3 3.0.5 3.0.51 3.0.60 3.0.61 3.0.62 3.0.70 3.0.71 3.0.72 3.1.0 All 34 releases
double-opt-in / src / EventSystem / EventDispatcherInterface.php

EventDispatcherInterface.php in Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification 5.5.0, at src/EventSystem/EventDispatcherInterface.php

77 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Event Dispatcher Interface
4 *
5 * @package Forge12\DoubleOptIn\EventSystem
6 * @since 4.0.0
7 */
8
9 namespace Forge12\DoubleOptIn\EventSystem;
10
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit;
13 }
14
15 /**
16 * Interface EventDispatcherInterface
17 *
18 * @api
19 *
20 * PSR-14 inspired event dispatcher with WordPress hook bridging support.
21 *
22 * Covered by the Addon API semver policy as of Core API 4.3.0. Use
23 * `$container->get(EventDispatcherInterface::class)` inside an addon's
24 * boot() to subscribe to lifecycle events. See docs/addon-api.md §6 for
25 * the event catalogue.
26 */
27 interface EventDispatcherInterface {
28
29 /**
30 * Dispatch an event to all registered listeners.
31 *
32 * @param object $event The event to dispatch.
33 *
34 * @return object The same event object, potentially modified by listeners.
35 */
36 public function dispatch( object $event ): object;
37
38 /**
39 * Add a listener for a specific event.
40 *
41 * @param string $eventName The fully qualified class name of the event.
42 * @param callable $listener The listener callable.
43 * @param int $priority Higher priority = earlier execution (like WordPress hooks).
44 *
45 * @return void
46 */
47 public function addListener( string $eventName, callable $listener, int $priority = 10 ): void;
48
49 /**
50 * Remove a listener.
51 *
52 * @param string $eventName The event class name.
53 * @param callable $listener The listener to remove.
54 *
55 * @return void
56 */
57 public function removeListener( string $eventName, callable $listener ): void;
58
59 /**
60 * Check if an event has any listeners.
61 *
62 * @param string $eventName The event class name.
63 *
64 * @return bool
65 */
66 public function hasListeners( string $eventName ): bool;
67
68 /**
69 * Get all listeners for an event, sorted by priority.
70 *
71 * @param string $eventName The event class name.
72 *
73 * @return callable[]
74 */
75 public function getListeners( string $eventName ): array;
76 }
77