{@inheritdoc}

@param mixed $events (string|array)
@param callable $listener
@param int $priority
@return void
178945
public function listen($events, $listener, $priority=0)
    {
        $this->dispatcher->listen($events, $listener, $priority);
    }
138605
public function attach(EventManagerInterface $events, $priority = 1)
    {
        $this->listeners[] = $events->attach(ComposerEvent::EVENT_COMPOSE_PRE, [$this, 'setMessageEncoding']);
    }
1352106
public function attachEvent($event, $handler, $priority = 0)
    {
        $this->eventDispatcher->addListener($event, $handler, $priority);
        return $this;
    }
507435
public function addListeners($event, $listeners)
    {
        foreach ($listeners as $listener) {
            $this->addListener($event, $listener);
        }
    }
830402
public function listen($events, $listener)
    {
        foreach ((array) $events as $event) {
            if (Str::contains($event, '*')) {
                $this->setupWildcardListen($event, $listener);
            } else {
                $this->listeners[$event][] = $this->makeListener($listener);
            }
        }
    }
151228
public function getListenerPriority($listener, $event)
    {
        if ($event instanceof EventInterface) {
            $event = $event->getName();
        }

        if (isset($this->listeners[$event])) {
            return $this->listeners[$event]->getPriority($listener);
        }

        return null;
    }
594327
public function attach($event, $callback, $priority = 0)
    {
        if (!isset($this->eventListeners[$event])) {
            $this->clearListeners($event);
        }

        $this->eventListeners[$event]->insert($callback, $priority);

        return true;
    }
687509
final public function registerEvent($event_name, $callback, $priority)
    {
        $event_name = trim($event_name);
        if (!isset($this->listeners[$event_name])) {
            $this->listeners[$event_name] = array();
        }
        $event = array(
            'event_name' => $event_name,
            'callback' => $callback,
            'priority' => (int)$priority
        );
        array_push($this->listeners[$event_name], $event);
        if (count($this->listeners[$event_name]) > 1) {
            usort($this->listeners[$event_name], array($this, 'sortListenerByPriority'));
        }
        return $this;
    }
645397
private function invokeListener($listener, $event)
    {
        if (is_array($listener))
        {
            list($listenerClass, $method) = $listener;

            $listenerInstance = $this->objectManager->get($listenerClass);
            $listenerInstance->{$method}($event);
        }
        else
        {
            call_user_func($listener, $event);
        }
    }
1368120
public static function listen($eventId, $callable, $priority = 0)
    {
        /**
         * Closure to wrap the Symphony event dispather callbacks to make for a nicer API
         *
         * @param EventObject $eventObject
         */
        $closure = function ($eventObject) use ($callable) {

            // Get any passed in data
            $data = $eventObject->getData();

            // Work out if we should stop event propogation
            $returnValue = $callable($data, $eventObject->getEventId(), $eventObject->getOriginalId());

            if ($returnValue === false) {
                $eventObject->stopPropagation();
            }
        };

        Event::eventDispatcherInstance()->addListener($eventId, $closure, $priority);

        return new EventInstance($eventId, $closure);
    }
403447
public function listen($events, $listener, $priority = 0, $acceptedArgs = 1)
    {
        foreach ((array)$events as $event)
        {
            $this->listeners[$event][$priority][] = $this->makeListener($listener);

            unset($this->sorted[$event]);

            if ( ! isset($this->registeredWpActions[$event]))
            {
                $this->registeredWpActions[$event] = true;

                add_action(
                    $event,
                    function () use ($event)
                    {
                        return $this->fire($event, func_get_args());
                    },
                    $priority,
                    $acceptedArgs
                );
            }
        }
    }
911382
public static function insert($eventName = NULL, $callback = NULL, $priority = NULL)
    { 
        if( $callback === NULL || is_int($callback) )
        {
            $priority  = $callback;
            $callback  = $eventName;
            $eventName = Properties::$startListenerName;
        }
        else
        {
            Properties::$startListenerName = $eventName;
        }

        $callback = self::callback($callback);
            
        if( ! is_callable($callback) )
        {
            throw new InvalidCallbackMethodException;
        }

        if( isset(Properties::$listeners[$eventName]) )
        {
            Properties::$listeners[$eventName][0][] = $priority;
			Properties::$listeners[$eventName][1][] = $callback;
        }
        else
        {
            Properties::$listeners[$eventName] = [[$priority], [$callback]];
        }
    }
98161
public function registerEventListeners(DispatcherContract $events)
    {
        foreach ($this->listen as $event => $listeners) {
            $defaultPriority = 0;
            if (!is_array($listeners)) {
                $events->listen($event, $listeners);
                continue;
            }
            foreach ($listeners as $listener => $priority) {
                if (is_numeric($listener)) {
                    $listener = $priority;
                    $priority = $defaultPriority;
                }
                if (is_array($listener)) {
                    $priority = is_numeric(current($listener)) ? current($listener) : $defaultPriority;
                    $listener = key($listener);
                }
                $events->listen($event, $listener, $priority);
            }
        }
        foreach ($this->subscribe as $subscriber) {
            $events->subscribe($subscriber);
        }
    }
1304146
public function on($eventName, $callback, $priority = 0)
    {
        if ($this->booted) {
            $this->container['event_dispatcher']->addListener($eventName, $this->container['callback_resolver']->resolveCallback($callback), $priority);

            return;
        }

        $this->container->extend('event_dispatcher', function ($dispatcher, $c) use ($callback, $priority, $eventName) {
            $dispatcher->addListener($eventName, $c['callback_resolver']->resolveCallback($callback), $priority);

            return $dispatcher;
        });
    }
265615
protected function walkEventList(array $events, callable $callback)
    {
        if (0 === \count($events)) {
            return;
        }
        /**
         * @var string     $eventName
         * @var array      $priorities
         * @var int|string $priority
         * @var array      $listeners
         * @var array      $listener
         */
        foreach ($events as $eventName => $priorities) {
            if (!\is_array($priorities) || 0 === \count($priorities)) {
                $mess = 'Must have as least one priority per listed event';
                throw new \LengthException($mess);
            }
            foreach ($priorities as $priority => $listeners) {
                if (!\is_array($listeners) || 0 === \count($listeners)) {
                    $mess = 'Must have at least one listener per listed priority';
                    throw new \LengthException($mess);
                }
                foreach ($listeners as $listener) {
                    $callback($eventName, $listener, $priority);
                }
            }
        }
    }
1135083
public function listen($event,$listener){
        $listers_of_event = isset($this->listeners[$event]) ? $this->listeners[$event] : array();
        if (!in_array($listener,$listers_of_event,true)){
            $listers_of_event[] = $listener;
            $this->listeners[$event] = $listers_of_event;
        }
    }
1008441
public static function insert($eventName = NULL, $callback = NULL, $priority = NULL) : Event
    {
        Listener::insert($eventName, $callback, $priority);

        return new self;
    }