1<?php
2
3declare(strict_types=1);
4
5namespace JMS\Serializer\EventDispatcher;
6
7interface EventDispatcherInterface
8{
9    /**
10     * Returns whether there are listeners.
11     */
12    public function hasListeners(string $eventName, string $class, string $format): bool;
13
14    /**
15     * Dispatches an event.
16     *
17     * The listeners/subscribers are called in the same order in which they
18     * were added to the dispatcher.
19     */
20    public function dispatch(string $eventName, string $class, string $format, Event $event): void;
21
22    /**
23     * Adds a listener.
24     *
25     * @param mixed $callable
26     */
27    public function addListener(string $eventName, $callable, ?string $class = null, ?string $format = null, ?string $interface = null): void;
28
29    /**
30     * Adds a subscribers.
31     */
32    public function addSubscriber(EventSubscriberInterface $subscriber): void;
33}
34