@param $eventName

@throws \DomainException
@throws \InvalidArgumentException
19185
protected function checkEventName(string $eventName)
    {
        if ('' === $eventName) {
            $mess = 'Event name can NOT be empty';
            throw new \DomainException($mess);
        }
        if (!\ctype_print($eventName)) {
            $mess = 'Using any non-printable characters in the event name is NOT allowed';
            throw new \DomainException($mess);
        }
    }
158838
private function forgetScenarioOnAfterEvent($eventName)
    {
        if (!in_array($eventName, array(ScenarioTested::AFTER, ExampleTested::AFTER))) {
            return;
        }

        $this->scenario = null;
    }
669704
public function performEvent($eventName, $eventData = null)
    {
        $url = $this->url() . '/command/' . $eventName;
        $response = $this->api->post($url, $eventData);
        $this->data = (array) $response->data;

        return $this;
    }
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));
    }
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;
    }
484007
public function dispatch($eventName, Event $event = null)
    {
        $this->lazyLoad($eventName);

        return parent::dispatch($eventName, $event);
    }
334281
public function addEventTypeIfNotExists($eventName, $fields) {
        $this->checkRequiredKeys(__METHOD__, $fields, array('LID'));

        $item = $this->getEventType(array(
            'EVENT_NAME' => $eventName,
            'LID' => $fields['LID']
        ));

        if ($item) {
            return $item['ID'];
        }

        return $this->addEventType($eventName, $fields);
    }
808961
public function handle(DomainEvent $event) : void {
        $method = lcfirst($this->getShortName($event));
        if (method_exists($this, $method)) {
            $this->$method($event);
        }
    }
774271
protected function afterDispatch(string $eventName, $event)
    {
        $this->postDispatch($eventName, $event instanceof Event ? $event : new LegacyEventProxy($event));
    }
1212768
public function setEventType($eventType)
    {
        $allowedValues = $this->getEventTypeAllowableValues();
        if (!in_array($eventType, $allowedValues)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'eventType', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['eventType'] = $eventType;

        return $this;
    }
172379
protected function fetchEvent($eventName)
    {
        return (array_key_exists($eventName, $this->events)) ? $this->events[$eventName] : null;
    }
831701
private function sortListeners(string $eventName)
	{
        $listeners = &$this->listeners[$eventName];

		\krsort($listeners);
		$this->sorted[$eventName] = \array_merge(...$listeners);
	}
927908
public function findOne($eventName)
    {
        foreach ($this->events as $event) {
            if ((string) new EventName($event) === $eventName) {
                return $event;
            }
        }

        return null;
    }
318770
public function fireEvent($eventName, Event $event = null)
    {
        /** @var EventDispatcher $events */
        $events = $this['events'];

        return $events->dispatch($eventName, $event);
    }
1062047
protected function when(DomainEvent $event)
    {
        $method = 'when' . ClassToString::short($event);
        if (is_callable([$this, $method])) {
            $this->{$method}($event);
        }
    }
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;
            }
        }
    }
761651
public function trigger( $eventName, $event = null )
    {
        if ( null === $event )
        {
            $event = new SeedEvent( $this );
        }

        return EventManager::trigger( $eventName, $event );
    }