@param string $name
@param Event $event

@return string
177871
public function serializeEvent($name, Event $event)
    {
        $context = SerializationContext::create();

        return serialize(array(
            'name' => $name,
            'class' => get_class($event),
            'event' => $this->serializer->serialize($event, 'json', $context),
        ));
    }
21887
public function getAttr(string $name): string {
        $node = $this->collection()->first();

        if (!($node instanceof \DOMElement)) {
            return '';
        }

        $result = $node->getAttribute($name);

        if (empty($result)) {
            return '';
        }

        return $result;
    }
1047158
function getEvent(string $name) {
        if(isset($this->wsevents[$name])) {
            return $this->wsevents[$name];
        }
        
        throw new \Exception('Unable to find WS event');
    }
1228410
private function getEventLevel(Event $event)
    {
        $type = $event->getType();

        switch ($type) {
            case Event::INFO:    return LogLevel::INFO;
            case Event::SUCCESS: return LogLevel::NOTICE;
            case Event::WARNING: return LogLevel::WARNING;
            case Event::ERROR:   return LogLevel::ERROR;
        }

        throw new \InvalidArgumentException("$type is not a valid event type");
    }
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);
    }
984643
private function formatEventMessage(Event $event)
    {
        $message = null;
        $entityName = null;
        
        if ($event instanceof OrmEventInterface) {
            switch (true) {
                case ($event instanceof EntityLifecycleEvent):
                    $entityName = $event->getRepository()->getEntityName();
                    $message = $this->entityToString($event->getEntity());
                    break;
                case ($event instanceof MetadataLoadEvent):
                    $message = $this->metadataToString($event->getMetadata());
                    $entityName = $event->getMetadata()->getEntityClass();
                    break;
                case ($event instanceof FinderExecutionEvent):
                    $entityName = $event->getRepository()->getEntityName();
                    $query = $event->getSelectQuery();
                    $message = sprintf("SQL: (%s)", str_replace("\n", "\x20", $query->toSQL()));
                    break;
            }
        }
        
        $eventName = sprintf('%s::%s', (new \ReflectionObject($event))->getShortName(), $event->getName());
        $separator = str_repeat('-', 32);
        
        return sprintf("%s\n[%s]\nEntityClassName: %s\n%s", $separator, $eventName, $entityName, $message);
    }
857846
protected function dispatch($name, Event $event)
    {
        $this->assertEventName($name);
        $this->getEventDispatcher()->dispatch($name, $event);
        return $this;
    }
370083
public function getEventScript($name)
    {
        $cacheKey = Cache::EVENT_SCRIPT_CACHE_PREFIX . $name;
        try {
            /** @var EventScript $model */
            $model = \Cache::rememberForever($cacheKey, function () use ($name) {
                if ($model = EventScript::whereName($name)->whereIsActive(true)->first()) {
                    return $model;
                }

                return ''; // so that we don't hit the database even after we know it isn't there
            });

            if (!empty($model)) {
                return $model;
            }
        } catch (\Exception $ex) {
        }

        return null;
    }
250583
public function getEventLog(Event $event, $eventName)
    {
        $eventLog = $this->getEventLogObject($this->getEventLogInfo($event, $eventName));

        if (null === $eventLog) {
            return null;
        }

        $eventLog->setTypeId($eventName);
        $eventLog->setIp($this->getClientIp());
        $eventLog->setEventTime(new \DateTime());
        $this->setUser($eventLog);

        return $eventLog;
    }
1200988
protected function buildClass($name): string
    {
        $event = $this->option('event');

        if (! starts_with($event, [
            $this->rootNamespace(),
            'Illuminate',
            '\\',
        ])) {
            $event = $this->rootNamespace().'Events\\'.$event;
        }

        $stub = str_replace(
            'DummyEvent', class_basename($event), $this->defaultBuildClass($name)
        );

        return str_replace(
            'DummyFullEvent', $event, $stub
        );
    }
1366364
public function dispatch($event_name, Event $event)
    {
        $dir = $this->events_dir.$event_name.'/';

        if (!file_exists($dir)) {
            mkdir($dir, 0755, true);
        }

        $event = serialize($event);
        file_put_contents($dir.md5($event).'.meta', $event);
    }
1098104
public function getStatus($name = '') {
        if ($name != '') {
            if (isset($this->_events[$name])) {
                return $this->_events[$name]->getStatus();
            }
            else {
                return false;
            }
        }
        else {
            return false;
        }
    }
318770
public function fireEvent($eventName, Event $event = null)
    {
        /** @var EventDispatcher $events */
        $events = $this['events'];

        return $events->dispatch($eventName, $event);
    }
556382
public function getApiRequestUrl(Event $event)
    {
        $params = $event->getCustomParams();
        $query = trim(implode(" ", $params));

        $querystringParams = [
            'v' => '1.0',
            'q' => $query
        ];

        return sprintf("%s?%s", $this->apiUrl, http_build_query($querystringParams));
    }
1186913
public function renderEvent(Event $event)
    {
        $parts = array_map('ucfirst', array_filter(preg_split('/_|\./', $event->name)));
        $name = 'on'.implode($parts);

        if (is_callable(array($this, $name))) {
            return call_user_func(array($this, $name), $event);
        } else {
            return null;
        }
    }
277824
public function get($name, $default = null)
    {
        if (array_key_exists($name, $this->eventData)) {
            return $this->eventData[$name];
        }

        return $default;
    }
421484
protected function eventsCallback(string $name, string $event): void
    {
        $this->server->on($name, function () use ($name, $event) {
            try {
                $this->eventObjects[$name] = new $event(...$this->filterServer(func_get_args()));
                $this->eventObjects[$name]->handle($this);
            } catch (\Exception $e) {
                $this->app->make(ExceptionHandler::class)->report($e);
            } catch (\Throwable $e) {
                $this->app->make(ExceptionHandler::class)->report(new FatalThrowableError($e));
            }
        });
    }