@param string $eventName
@param string $script

@return bool
356719
private function hasScript($eventName, $script)
    {
        $scripts = $this->event->getComposer()->getPackage()->getScripts();
        if (!isset($scripts[$eventName])) {
            return false;
        }

        return in_array($script, $scripts[$eventName]);
    }
1151532
public function removeListener($eventName, $listener)
    {
        if (!isset($this->listeners[$eventName])) {
            return false;
        }

        // removing listeners for a given event
        foreach ($this->listeners[$eventName] as $i => $callback) {
            if ($listener === $callback) {
                unset($this->listeners[$eventName][$i]);
            }
        }

        // cleaning listener container if there is not more listeners on it
        if (count($this->listeners[$eventName]) == 0) {
            unset($this->listeners[$eventName]);
        }
    }
149340
public function unsubscribeEvent($eventName)
    {
        if (!isset($this->subscribedEvents[$eventName])) {
            throw new InvalidArgumentException("Event $eventName doesn't exists in client context");
        }

        $this->subscribedEvents[$eventName] = false;
    }
1190673
public function hasEventHandler($name)
    {
        $name = strtolower($name);
        return isset($this->_events[$name]) && count($this->_events[$name]) > 0;
    }
1344759
protected function createEvent($eventName)
    {
        if (null === $this->defaultEvent) {
            return new Event($eventName);
        }
        $event = clone $this->defaultEvent;
        $event->setName($eventName);
        return $event;
    }
397885
protected function getEventLogInfo(Event $event, $eventName)
    {
        if ($event instanceof EmbeddedEventResolverInterface) {
            return $event->getEventLogInfo($eventName);
        }

        if (null === $eventResolver = $this->getResolver($eventName)) {
            return null;
        }

        return $eventResolver->getEventLogInfo($event, $eventName);
    }
777028
public function onFlash($eventName, array $data)
    {
        $this->validateEventData($data);

        list($notification, $notificationBag, $message) = $data;

        $key = implode('.', [$this->key, $notificationBag->getName()]);

        $this->session->push($key, $message);

        return true;
    }
561866
public function hasEventHandlers($name)
    {
        $this->ensureBehaviors();
        return !empty($this->__events__[$name]) || Event::hasHandlers($this, $name);
    }
614892
public function trigger($eventName, $target = null)
    {
        $event = $this->createEvent($eventName);
        $event->setTarget($target);
        $this->triggerHandlers($event);
    }
172150
public function dispatchEvent($eventName, Event $event = null)
    {
        if ($this->eventDispatcher instanceof EventDispatcherInterface) {
            $this->eventDispatcher->dispatch($eventName, $event);
        }
    }
601210
protected function isEventHandlerExclusion($className, $methodName, array $methodParams)
    {
        if (strpos($className, 'EventHandler') === false) {
            // Not EventHandler class.
            return false;
        }

        return substr($methodName, 0, 2) == 'On' && count($methodParams) === 1 && $methodParams[0]['name'] === '$event';
    }
771521
public function handleServiceEvent($event)
    {
        Log::debug('Service event handled: ' . $event->name);

        if ($script = $this->getEventScript($event->name)) {
            Log::debug('Service event script found: ' . $event->name);
            $data = $event->makeData();

            if (null !== $result = $this->handleEventScript($script, $data)) {
                return $this->handleEventScriptResult($script, $result);
            }
        } elseif ($script = $this->getEventScript($event->name . '.queued')) {
            Log::debug('Queued service event script found: ' . $event->name);
            $result = $this->dispatchNow(new ServiceEventScriptJob($event->name . '.queued', $event, $script->config));
            Log::debug('Service event queued: ' . $event->name . PHP_EOL . $result);
        }

        return true;
    }
1127704
public function run(ScriptEvent $event): bool
    {
        if (!$this->shouldRun($event)) {
            return true;
        }
        $io = $event->getIO();
        $io->writeError('');
        $io->writeError('<info>Setting up TYPO3</info>');

        $this->initializeCompatibilityLayer($event);
        $consoleIO = new ConsoleIo($io);

        $setup = new InstallActionDispatcher(
            new ConsoleOutput($consoleIO->getOutput(), $consoleIO->getInput()),
            CommandDispatcher::createFromComposerRun()
        );
        $setup->dispatch([]);

        $io->writeError('');
        $io->writeError('<info>Your TYPO3 installation is now ready to use.</info>');

        $localRepository = $event->getComposer()->getRepositoryManager()->getLocalRepository();
        $serverCommandPackage = $localRepository->findPackage('typo3-console/php-server-command', new EmptyConstraint());
        if ($serverCommandPackage !== null) {
            $io->writeError('');
            $io->writeError(sprintf('<info>Run</info> <comment>%s server:run</comment> <info>in your project root directory, to start the PHP builtin web server.</info>', substr($event->getComposer()->getConfig()->get('bin-dir') . '/typo3cms', strlen(getcwd()) + 1)));
        }

        return true;
    }
165863
public function execute($eventName, $object)
    {
        if (isset($this->events[$eventName]) && is_array(($this->events[$eventName]))) {
            foreach ($this->events[$eventName] as $method) {
                call_user_func([$object, $method]);
            }
        }
    }
682314
public function subscribeEvent($eventName)
    {
        if (!isset($this->subscribedEvents[$eventName])) {
            throw new InvalidArgumentException("Event $eventName doesn't exists in client context");
        }

        $this->subscribedEvents[$eventName] = true;
    }
419570
protected function dispatchEvent($eventName, \Symfony\Component\EventDispatcher\Event $event)
    {
        if (!$event->isPropagationStopped()) {
            $dispatcher = $this->getEventDispatcher();
            $dispatcher->dispatch($eventName, $event);
        }
        return !$event->isPropagationStopped();
    }
293368
protected function updateScriptEvents()
    {
        if (!$this->control || !ScriptLabel::isEventLabel($this->labelName)) {
            return $this;
        }
        if ($this->control instanceof Scriptable) {
            $this->control->setScriptEvents(true);
        }
        return $this;
    }