@param string $eventName
@param array $withArgs

@return mixed|null
3086
private function callListener(string $eventName, array $withArgs)
    {
        $listener = Container\get($eventName);

        if (is_callable($listener)) {
            return call_user_func_array($listener, $withArgs);
        }

        return null;
    }
637861
public function getEventActions($eventName)
    {
        $events = isset($this->events[$eventName]) ? $this->events[$eventName] : [];

        return is_array($events) ? $events : [$events];
    }
418727
public function loadClassMetadata(EventArgs $eventArgs)
    {
        if ( ! $eventArgs instanceof CommonEventArgs
            && ! $eventArgs instanceof OrmEventArgs
        ) {
            throw InvalidArgumentException::create(
                'Doctrine\Common\Persistence\Event\LoadClassMetadataEventArgs',
                $eventArgs
            );
        }
        $ea = $this->getEventAdapter($eventArgs);
        $this->loadMetadataForObjectClass($ea->getObjectManager(), $eventArgs->getClassMetadata());
    }
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;
    }
1301755
public function bind($eventName, $scenarioClassName)
    {
        if (!is_callable($scenarioClassName)) {
            $this->assertScenarioExists($scenarioClassName);
            $this->assertScenarioIsRunnable($scenarioClassName);
        }

        // todo solve multiple event bindings problem
        // actual solution is to rebind, latest binding wins

        $this->registeredScenarios[$eventName] = $scenarioClassName;
    }
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;
    }
795399
protected function getEventAdapter(EventArgs $args)
    {
        $class = get_class($args);
        if (preg_match('@Doctrine\\\([^\\\]+)@', $class, $m) && in_array($m[1], ['ODM', 'ORM'])) {
            if (!isset($this->adapters[$m[1]])) {
                $adapterClass = 'Gedmo\\Mapping\\Event\\Adapter\\' . $m[1];
                $this->adapters[$m[1]] = new $adapterClass();
            }

            $this->adapters[$m[1]]->setEventArgs($args);
            return $this->adapters[$m[1]];
        }

        throw new \InvalidArgumentException('Session continaer does not support event arg class: ' . $class);
    }
673113
function triggerModeScriptEvent($event, $params = '', $multicall = false)
    {
        if (!is_string($event)) {
            throw new InvalidArgumentException('event name must be a string: event = ' . print_r($event, true));
        }

        if (is_string($params)) {
            return $this->execute(ucfirst(__FUNCTION__), array($event, $params), $multicall);
        }

        if (is_array($params)) {
            foreach ($params as $param) {
                if (!is_string($param)) {
                    throw new InvalidArgumentException('argument must be a string: param = ' . print_r($param, true));
                }
            }
            return $this->execute(ucfirst(__FUNCTION__) . 'Array', array($event, $params), $multicall);
        }

        // else
        throw new InvalidArgumentException('argument must be string or string[]: params = ' . print_r($params, true));
    }
1186231
public function dispatchEvent($eventName, EventInterface $event = null)
    {
        $this->getEventDispatcher()->dispatch($eventName, $event);
        
        return $this;
    }
425675
final public static function getEverythingFromArgs(\Enlight_Event_EventArgs $args, $element = null)
    {
        /**
         * @var \Enlight_Controller_Action $controller
         */
        $controller = $args->get('subject');

        /**
         * @var \Enlight_Controller_Request_Request $request
         */
        $request = $controller->Request();

        /**
         * @var \Enlight_View_Default $view
         */
        $view = $controller->View();

        $result = [
            'controller' => $controller,
            'request' => $request,
            'view' => $view
        ];

        if ($element !== null) {
            if (array_key_exists($element, $result)) {
                $result = $result[$element];
            } else {
                $result = null;
            }
        }

        return $result;
    }
1364619
public function getListeners($eventName)
    {
        $listeners = $this->listeners[$eventName] ? $this->listeners[$eventName] : [];

        // Ordenar por prioridade
        krsort($listeners);
        $result = [];
        foreach ($listeners as $list) {
            foreach ($list as $listener) {
                $result[] = $listener;
            }
        }
        //$listeners = call_user_func_array('array_merge', $listeners);

        return $result;
    }
506318
public function dispatch($eventName, $params)
    {
        if (isset($this->enabledProviderListeners[$eventName])) {
            foreach ($this->enabledProviderListeners[$eventName] as $callback) {
                call_user_func_array($callback, $params);
            }
        }
    }
1113660
public function invokeGlobalEvent($eventName, EventArgs $event)
    {
        if ($this->eventManager->hasListeners($eventName)) {
            $this->eventManager->dispatchEvent($eventName, $event);
        }
    }
378096
protected function getProvider(EventArgs $args)
    {
        $media = $this->getMedia($args);

        if (!$media instanceof MediaInterface) {
            return;
        }

        return $this->getPool()->getProvider($media->getProviderName());
    }
166833
protected function getArgumentPath($withName = false)
    {
        $name = $this->argumentName();

        if (str_contains($name, '.')) {
            $name = str_replace('.', '/', $name);
        }

        if (str_contains($name, '\\')) {
            $name = str_replace('\\', '/', $name);
        }

        // ucfirst char, for correct namespace
        $name = implode('/', array_map('ucfirst', explode('/', $name)));

        // if we need to keep lowercase
        if ($this->settingsDirectoryFormat() === 'strtolower') {
            $name = implode('/', array_map('strtolower', explode('/', $name)));
        }

        // if we want the path with name
        if ($withName) {
            return $name . '/';
        }

        if (str_contains($name, '/')) {
            return substr($name, 0, strripos($name, '/') + 1);
        }

        return '';
    }
668324
public function triggerEvent($eventName, $entity, $eventArgs = null, Event $event = null)
    {
        if (null === $event) {
            $event = new Event($entity, $eventArgs);
        }

        $this->dispatch($this->formatEventName($eventName, $entity), $event);

        if ($entity instanceof AbstractClassContent) {
            foreach (class_parents($entity) as $class) {
                if ($class === 'BackBee\ClassContent\AbstractClassContent') {
                    break;
                }

                $this->dispatch($this->formatEventName($eventName, $class), $event);
            }

            $this->dispatch(strtolower('classcontent.'.$eventName), $event);
        }
    }
482211
public function getEventMessage($eventName) {
        $filter = is_array($eventName) ? $eventName : array(
            'EVENT_NAME' => $eventName,
        );

        $by = 'id';
        $order = 'asc';

        $item = \CEventMessage::GetList($by, $order, $filter)->Fetch();
        return $this->prepareEventMessage($item);
    }