Adds an event to the builder.
@param \ManiaScript\Builder\Event\AbstractEvent $event The event.
@return $this Implementing fluent interface.
489780
public function addEvent(AbstractEvent $event) {
        $this->eventHandlerFactory->getHandlerForEvent($event)->addEvent($event);
        return $this;
    }
1109442
public function addEvents(array $events)
    {
        foreach ($events as $event) {
            if ($event instanceof EventInterface) {
                $this->addEvent($event);
            }
        }
        return $this;
    }
1139341
private function doModify(AbstractUserEvent $event)
    {
        $this->classMetadata->modifyProperty(
            $event->getUser(),
            new \DateTime(sprintf('@%s', $this->requestStack->getMasterRequest()->server->get('REQUEST_TIME'))),
            ClassMetadata::LAST_ACTION_PROPERTY
        );
    }
866059
public function createFromSerializedEvent(SerializedEvent $event)
    {
        return new Event(
            $event->getId(),
            $event->getName(),
            $this->serializer->deserialize(
                $event->getName(),
                $event->getPayload()
            ),
            $event->getPayloadVersion(),
            $event->getVersion(),
            $event->getDate()
        );
    }
926522
public function setTitleOnDocument(AbstractMappingEvent $event)
    {
        $document = $event->getDocument();

        if (!$this->supports($document)) {
            return;
        }

        if ($document instanceof LocalizedTitleBehavior) {
            if (!$event->getLocale()) {
                return;
            }

            $document->setTitle(
                $event->getNode()->getPropertyValueWithDefault(
                    $this->propertyEncoder->localizedContentName(static::PROPERTY_NAME, $event->getLocale()),
                    ''
                )
            );
        } else {
            $document->setTitle(
                $event->getNode()->getPropertyValueWithDefault(
                    $this->propertyEncoder->contentName(static::PROPERTY_NAME),
                    ''
                )
            );
        }
    }
886717
public function setEventManager(EventManagerInterface $events)
    {
        
        $events->setIdentifiers(array(
            'Zend\Stdlib\DispatchableInterface',
            'Zend\Mvc\Controller\AbstractController',
            'Zend\Mvc\Controller\AbstractActionController',
            __CLASS__,
            get_called_class(),
            $this->eventIdentifier,
            substr(get_called_class(), 0, strpos(get_called_class(), '\\'))
        ));
        $this->events = $events;
        $this->attachDefaultListeners();

        return $this;
    }
85211
public function setEvent($event)
  {
    if ($event === '?' || $event === '') {
      $this->event = null;
    } else {
      $event = Util::foreignLettersToEnglishLetters($event);
      $event = Util::titleCaseIfCurrentlyAllCaps($event);
      $this->event = $event === '?' ? null : $event;
    }
  }
832258
public static function onFlushContent(Event $event)
    {
        $content = $event->getTarget();
        if (!($content instanceof AbstractClassContent)) {
            return;
        }

        $page = $content->getMainNode();
        if (null === $page) {
            return;
        }

        $newEvent = new Event($page, $content);
        $newEvent->setDispatcher($event->getDispatcher());
        self::onFlushPage($newEvent);
    }
186427
protected function buildGlobalCodeOfEvent(AbstractEvent $event) {
        $result = '';
        if (!$event->getInline()) {
            $result .= $this->buildHandlerFunction($event);
        }
        return $result;
    }
1055707
public function on($event, callable $fn) {
        if (!isset($this->events[$event])) {
            $this->events[$event] = [];
        }
        $this->events[$event][] = $fn;
        return $this;
    }
761521
protected function dispatchEvent($event)
    {
        if (!$this->container) {
            throw new \RuntimeException("The container has not been set up.");
        }
        $dir = $this->container->getParameter('base_dir');
        if (!is_dir($dir) || !is_readable($dir)) {
            throw new \RuntimeException("'${dir}' is not a valid readable directory.");
        }
        $dispatcher = $this->container->get('event_dispatcher');
        $dispatcher->dispatch($event);
    }
688539
public function addEvent(EventEntity $event)
    {
        if (!$this->events->contains($event)) {
            $this->events[] = $event;
        }
        
        return $this;
    }
17293
public void addEvent(Event event) {
        if(event == null)
            throw new IllegalStateException("event must be non-null");

        if(logger.isTraceEnabled())
            logger.trace("Adding event " + event);

        eventQueue.add(event);
    }
422051
protected <T extends DomainEvent> T registerEvent(T event) {
        Assert.notNull(event, "Domain event must not be null!");

        this.domainEvents.add(event);
        return event;
    }
145790
public function setClient(AbstractClient $client)
    {
        $this->client = $client;

        $this->parser->setClient($this->client);

        return $this;
    }
308473
public function addEvent($name, EventInterface $event)
    {
        $this->container->get('bldr.dispatcher')->dispatch($name, $event);

        return $this;
    }
271232
protected static function instantiateConsoleInteraction(Event $event) {
        $consoleIO                = $event->getIO();
        self::$consoleInteraction = new ConsoleInteraction(new Input($consoleIO), new Output($consoleIO));
    }