@param string[] $eventNames

@return SimpleEventEmitter
345458
public function addAllowedEvents(array $eventNames): self
    {
        foreach ($eventNames as $eventName) {
            $this->addAllowedEvent($eventName);
        }

        return $this;
    }
161241
public function mergeEventListeners($eventListeners)
    {
        if ($eventListeners instanceof EventManagerInterface) {
            $eventListeners = $eventListeners->getEventListeners();
        }

        foreach (((array) $eventListeners) as $eventName => $listeners) {
            $queue = [];
            if (isset($this->eventListeners[$eventName])) {
                $innerListeners = clone $this->eventListeners[$eventName];
                $innerListeners->setExtractFlags(ListenerQueue::EXTR_DATA);
                foreach ($innerListeners as $callback) {
                    $queue[] = $callback;
                }
            }
            $listeners = clone $listeners;
            $listeners->setExtractFlags(ListenerQueue::EXTR_BOTH);
            foreach ($listeners as $listener) {
                if (!in_array($listener['data'], $queue)) {
                    $this->attach($eventName, $listener['data'], $listener['priority']);
                }
            }
        }

        return true;
    }
937415
public function removeListener($eventNames, $listener)
    {
        $key = $this->getListenerKey($listener);
        foreach ((Array) $eventNames as $eventName) {
            if (isset($this->listeners[$eventName][$key])) {
                unset($this->listeners[$eventName][$key]);
            }
        }
        return $this;
    }
1144867
public function getListeners(string ...$eventNames) : array
    {
        if (empty($eventNames)) return [];

        $key = implode('|', $eventNames);
        return $this->combinationListeners[$key] ?? [];
    }
34669
private function sortServiceListeners(string $eventName): ContainerMediatorInterface
    {
        if (0 === \count($this->serviceListeners)) {
            return $this;
        }
        if ('' !== $eventName) {
            if (!\array_key_exists($eventName, $this->serviceListeners)) {
                return $this;
            }
            $eventNames = [$eventName];
        } else {
            \ksort($this->serviceListeners);
            $eventNames = \array_keys(parent::getListeners());
        }
        foreach ($eventNames as $anEvent) {
            \krsort($this->serviceListeners[$anEvent], \SORT_NUMERIC);
        }
        return $this;
    }
927908
public function findOne($eventName)
    {
        foreach ($this->events as $event) {
            if ((string) new EventName($event) === $eventName) {
                return $event;
            }
        }

        return null;
    }
860463
protected function dispatchDataTablesEvent($eventName, array $entities) {

        $eventDispatcher = $this->getEventDispatcher();
        if (null !== $eventDispatcher && false === $eventDispatcher->hasListeners($eventName)) {
            return null;
        }

        $this->getLogger()->debug(sprintf("DataTables controller dispatch an event with name \"%s\"", $eventName));

        return $eventDispatcher->dispatch($eventName, new DataTablesEvent($eventName, $entities));
    }
693271
public function exportEventMessages($eventName) {
        $exports = array();
        $items = $this->getEventMessages($eventName);
        foreach ($items as $item) {
            $exports[] = $this->prepareExportEventMessage($item);
        }
        return $exports;
    }
172379
protected function fetchEvent($eventName)
    {
        return (array_key_exists($eventName, $this->events)) ? $this->events[$eventName] : null;
    }
167045
public function events($events=array())
    {
        if (!isset($this->_events)) {
            $this->_events = new Events(array(), self::schema()->events());
            $this->_registerDefaultEventHandlers();
        }

        if(count($events))
            foreach($events as $event=>$callback)
                $this->_events->register($event, $callback);

        return $this->_events;
    }
950793
public function trigger(string $eventName, EventInterface $event = \null): EventInterface
    {
        $this->checkEventName($eventName);
        if (\null === $event) {
            $event = new Event();
        }
        $priorities = $this->getListeners($eventName);
        if (0 !== \count($priorities)) {
            /**
             * @var array    $listeners
             * @var callable $listener
             */
            foreach ($priorities as $listeners) {
                foreach ($listeners as $listener) {
                    $listener($event, $eventName, $this);
                    /** @noinspection DisconnectedForeachInstructionInspection */
                    if ($event->hasBeenHandled()) {
                        break 2;
                    }
                }
            }
        }
        return $event;
    }
1322728
public function getListeners(string $eventName = ''): array
    {
        $this->sortListeners($eventName);
        if ('' !== $eventName) {
            return \array_key_exists($eventName, $this->listeners) ? $this->listeners[$eventName] : [];
        }
        return $this->listeners;
    }
957419
public function setEvents($events)
    {
        foreach ($events as $key => $dtoData) {
            $this->events[$key] = new MatchEventDto($dtoData);
        }
    
        return $this;
    }
897940
protected function triggerMethod($eventName, Event $event)
    {
        $method = sprintf('on%s', Container::camelize(str_replace('.', '_', $eventName)));

        if(is_callable([$this, $method])) {
            call_user_func_array([$this, $method], [$event]);
        }

        if($event->isPropagationStopped()){
            return $event;
        }

        $this->getDispatcher()->dispatch($eventName, $event);

        return $event;
    }
1247264
public function addEventListener($eventName, array $listeners)
    {
        if (!array_key_exists($eventName, $this->options['events'])) {
            $this->options['events'][$eventName] = [
                'object' =>BaseEvent::class,
                'listeners' => $listeners,
            ];
        }

        $this->options['events'][$eventName]['listeners'] = array_merge(
            $this->options['events'][$eventName]['listeners'],
            $listeners
        );

        return $this;
    }
1067860
public function setEventsList(array $events)
    {
        $this->data->events = array_merge($this->data->events, $events);

        return $this;
    }
1344759
protected function createEvent($eventName)
    {
        if (null === $this->defaultEvent) {
            return new Event($eventName);
        }
        $event = clone $this->defaultEvent;
        $event->setName($eventName);
        return $event;
    }