Installs a listener on a subscribable (not bus) source.

@param string $targetEventName
16889
protected function listenToBus($targetEventName)
    {
        foreach ($this->sourcePatterns as $pattern) {
            $listener = $this->newBusListener($pattern, $targetEventName);
            $this->source->on('*', $listener);
        }
        $this->isFixed = true;
    }
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;
    }
673395
protected function newEvent(
        $eventName,
        $target = null,
        array $parameters = []
    )/*# : EventInterface */ {
        if (is_object($eventName)) {
            return $eventName;
        } else {
            return new Event($eventName, $target, $parameters);
        }
    }
774271
protected function afterDispatch(string $eventName, $event)
    {
        $this->postDispatch($eventName, $event instanceof Event ? $event : new LegacyEventProxy($event));
    }
96997
function removeAllListeners(string $eventName = null) {

        if (!\is_null($eventName)) {
            unset($this->listeners[$eventName]);
            unset($this->listeners_flat[$eventName]);
        } else {
            $this->listeners = [];
            $this->listeners_flat = [];
        }

    }
321290
public function addListener(string $eventName, callable $listener, $priority = 0): MediatorInterface
    {
        $this->checkEventName($eventName);
        $priority = $this->getActualPriority($eventName, $priority);
        if (!(\array_key_exists($eventName, $this->listeners)
            && \array_key_exists($priority, $this->listeners[$eventName])
            && \in_array($listener, $this->listeners[$eventName][$priority], \true))
        ) {
            $this->listeners[$eventName][$priority][] = $listener;
        }
        return $this;
    }
70214
public function trigger($event, $target = null, $argv = [])
    {
        try {
            $result = false;

            // Create event or complete
            if ($event instanceof EventInterface) {
                if (!is_null($target)) {
                    $event->setTarget($target);
                }
                if (!empty($argv)) {
                    $event->setParams($argv);
                }
            } else {
                $event = new Event($event, $target, $argv);
            }

            // Call listeners
            if (Event::validEventName($event->getName()) && isset($this->listeners[$event->getName()])) {
                // Order by priority
                usort(
                    $this->listeners[$event->getName()],
                    function ($a, $b) {
                        if ($a['priority'] == $b['priority']) {
                            return 0;
                        }

                        return ($a['priority'] < $b['priority']) ? -1 : 1;
                    });

                // Call callbacks
                foreach ($this->listeners[$event->getName()] as $listener) {
                    if (!$event->isPropagationStopped()) {
                        $result = call_user_func($listener['callback'], $event);
                    }
                }
            }

            return $result;
        } catch (\Exception $e) {
            return false;
        }
    }
1334609
protected function addInterfaceListeners($eventName, array $listeners = [])
    {
        foreach (class_implements($eventName) as $interface) {
            if (isset($this->listeners[$interface])) {
                foreach ($this->listeners[$interface] as $names) {
                    $listeners = array_merge($listeners, (array) $names);
                }
            }
        }

        return $listeners;
    }
773522
function(eventName, listener) {
			if (typeof listener === "function" || listener.handleEvent) {
				this._namedListeners[eventName] = this._namedListeners[eventName] || [];
				this._namedListeners[eventName].push(listener);
			}
		}
117643
protected function getListeners($eventName)
    {
        if (isset($this->listeners[$eventName])) {
            return $this->listeners[$eventName];
        }
        return null;
    }
1302231
public function triggerEvent($eventName, Event $event = null)
    {
        if (!$event) {
            $event = new Event;
        }

        $event->setTarget($this);

        return $this->eventDispatcher->dispatch($eventName, $event);
    }
1338749
protected function newSubscribableListener($event, $targetEventName)
    {
        return function () use ($targetEventName, $event) {
            $args = func_get_args();
            $targetEventName = $this->buildTargetEventName($event, $targetEventName);
            return $this->target->fire($targetEventName, $args);
        };
    }
1357886
protected function lazyLoad($eventName)
    {
        if (isset($this->listenerIds[$eventName])) {
            foreach ($this->listenerIds[$eventName] as $args) {
                list($serviceId, $method, $priority) = $args;
                $listener = $this->container->get($serviceId);

                $key = $serviceId.'.'.$method;
                if (!isset($this->listeners[$eventName][$key])) {
                    $this->addListener($eventName, array($listener, $method), $priority);
                } elseif ($listener !== $this->listeners[$eventName][$key]) {
                    parent::removeListener($eventName, array($this->listeners[$eventName][$key], $method));
                    $this->addListener($eventName, array($listener, $method), $priority);
                }

                $this->listeners[$eventName][$key] = $listener;
            }
        }
    }
1198701
public function rename(string $interface, string $newName, string $sourceName = Name::ANY, string $targetInterface = '')
    {
        $targetInterface = $targetInterface ?: $interface;
        if ($this->lastModule instanceof self) {
            $this->lastModule->getContainer()->move($interface, $sourceName, $targetInterface, $newName);
        }
    }
1070379
public function addListener($name, $listener, $priority = 0)
    {
        if (! isset($this->listeners[$name])) $this->listeners[$name] = [];
        $this->listeners[$name][$priority][] = $listener;
    }
1225872
public function onInstallReleaseExecuteComposerInstall(InstallReleaseEvent $event, $eventName, EventDispatcherInterface $eventDispatcher)
    {
        $release = $event->getRelease();
        $host = $release->getWorkspace()->getHost();
        $connection = $this->ensureConnection($host);

        $eventDispatcher->dispatch(AccompliEvents::LOG, new LogEvent(LogLevel::NOTICE, 'Installing Composer dependencies.', $eventName, $this, array('event.task.action' => TaskInterface::ACTION_IN_PROGRESS)));

        $authenticationFile = $release->getPath().'/auth.json';
        if (empty($this->authentication) === false) {
            $connection->putContents($authenticationFile, json_encode($this->authentication));
        }

        $connection->changeWorkingDirectory($host->getPath());
        $result = $connection->executeCommand(sprintf('php composer.phar install --no-interaction --working-dir="%s" --no-dev --no-scripts --optimize-autoloader', $release->getPath()));

        if ($connection->isFile($authenticationFile)) {
            $connection->delete($authenticationFile);
        }

        if ($result->isSuccessful()) {
            $eventDispatcher->dispatch(AccompliEvents::LOG, new LogEvent(LogLevel::NOTICE, 'Installed Composer dependencies.', $eventName, $this, array('event.task.action' => TaskInterface::ACTION_COMPLETED, 'output.resetLine' => true)));
            $eventDispatcher->dispatch(AccompliEvents::LOG, new LogEvent(LogLevel::DEBUG, "{separator} Command output:{separator}\n{command.result}{separator}", $eventName, $this, array('command.result' => $result->getOutput(), 'separator' => "\n=================\n")));
        } else {
            throw new TaskCommandExecutionException('Failed installing Composer dependencies.', $result, $this);
        }
    }
664097
protected function addEventListener($name, $callback, $priority, $accepted_args)
    {
        $this->hooks[$name] = [$callback, $priority, $accepted_args];
        $this->addFilter($name, $callback, $priority, $accepted_args);
    }