@param       $eventName
@param       $data
@param array $expectedReactions

@return mixed
968862
public function dispatch($eventName, $data, array $expectedReactions)
    {
        $event = new Event($this->dispatcher);

        return $event->name($eventName)->with($data)->expect($expectedReactions)->getReaction();
    }
425183
public function setExpectedAndReceived($expected, $received)
    {
        $this->expected = is_string($expected)
            ? $expected : get_class($expected);

        $this->received = TypeHound::fetch($received);

        $this->message = vsprintf(
            'An instance of a %s was expected but got %s',
            [$this->expected, $this->received]
        );
    }
703850
protected function fireEvent($event, $data)
    {
        $fireableEvent = isset($this->fireEvents[$event]) ? $this->fireEvents[$event] : null;

        if (! is_null($fireableEvent)) {
            return $this->event->fire($fireableEvent, $data);
        }

        return null;
    }
79983
function (eventName, data) {
      if (document.createEvent) {
        var evt = document.createEvent('HTMLEvents');
        evt.initEvent(eventName, true, false);
        evt = this.extend(evt, data);
        return this.each(function (v) {
          return v.dispatchEvent(evt);
        });
      }
    }
621061
private function getEventSubscribers(string $eventName): array
    {
        if ($this->isEventAllowed($eventName) === false) {
            throw new EventNotFoundException($eventName);
        }

        $result = $this->getSubscribers()[$eventName] ?? [];

        return $result;
    }
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;
    }
673395
protected function newEvent(
        $eventName,
        $target = null,
        array $parameters = []
    )/*# : EventInterface */ {
        if (is_object($eventName)) {
            return $eventName;
        } else {
            return new Event($eventName, $target, $parameters);
        }
    }
557306
private function printHeaderOnAfterExampleEvent(Formatter $formatter, Event $event, $eventName)
    {
        if (!$event instanceof AfterScenarioTested || ExampleTested::AFTER !== $eventName) {
            return;
        }

        if ($this->headerPrinted) {
            return;
        }

        $feature = $event->getFeature();
        $stepTestResults = $this->getStepTestResults();

        $this->tablePrinter->printHeader($formatter, $feature, $this->outline, $stepTestResults);
        $this->headerPrinted = true;
    }
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);
        }
    }
393305
public function initialize($eventName)
    {
        $this->assertNotEmpty();

        $step = $this->getStepForEvent($eventName);

        $this->currentStep = $step->getName();

        $this->initialized = true;
    }
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;
    }
203893
public static function attributeTypeError($attributeName, $annotationName, $context, $expected, $actual)
    {
        return self::typeError(sprintf(
            'Attribute "%s" of @%s declared on %s expects %s, but got %s.',
            $attributeName,
            $annotationName,
            $context,
            $expected,
            is_object($actual) ? 'an instance of ' . get_class($actual) : gettype($actual)
        ));
    }
1071750
protected function beforeDispatch(string $eventName, $event)
    {
        $this->preDispatch($eventName, $event instanceof Event ? $event : new LegacyEventProxy($event));
    }
15203
public function getListenersForEvent($eventClassName)
    {
        if (FALSE === array_key_exists($eventClassName, $this->eventMap))
        {
            return [];
        }
        return $this->eventMap[$eventClassName];
    }
739502
public function dispatch($eventName = null)
    {
        // Tries to fetch the event by the given eventname
        $event = null;
        if (null !== $eventName) {
            $event = $this->fetchEvent($eventName);
        }

        // Fetches the last saved event
        if (null === $event && !empty($this->events)) {
            $eventNames = array_keys($this->events);
            $events = array_values($this->events);
            $elemens = count($events) - 1;
            $event = $events[$elemens];
            $eventName = $eventNames[$elemens];
        }

        if (null === $event) {
            throw new RuntimeException('exception_no_events');
        }

        $this->eventDispatcher->dispatch($eventName, $event);

        return $this;
    }
1253772
public function on(string $eventName, BaseEvent $data)
    {
        return $this->c->ed->dispatch($eventName, $data);
    }
935595
public function trigger($eventName, array $params = []) {
        $event = clone $this->event;
        $event->setName($eventName);

        // Add optional extra arguments
        foreach ($params as $key => $value) {
            $event->setArgument($key, $value);
        }

        // Fetch current user
        $user = $event->getRequest()->getUser();

        // Trigger all listeners for this event and pass in the event instance
        foreach ($this->getListenersForEvent($eventName) as $listener) {
            $event->setArgument('handler', $listener['handler']);
            $callback = $this->getHandlerInstance($listener['handler']);

            if ($callback instanceof ListenerInterface) {
                $callback = [$callback, $listener['method']];
            }

            $users = $listener['users'];

            if (!$this->triggersFor($user, $users)) {
                continue;
            }

            $callback($event);

            if ($event->isPropagationStopped()) {
                break;
            }
        }

        return $this;
    }