Collect information about the plugin
@param Event $event
@return array
966314
public static function questionnaire(Event $event)
    {
        // start
        $io = $event->getIO();
        $io->write(array(
            PHP_EOL . PHP_EOL,
            'Welcome to the Jumpstart Plugin generator',
            PHP_EOL . PHP_EOL . PHP_EOL,
            'This command will guide you through creating your basic plugin setup.'
        ));

        // Collect data
        static::$package = $io->askAndValidate(
            'Package (<vendor>/<name>):' . "\t",
            'Jumpstart\\Init::validatePackage'
        );
        static::$namespace = $io->askAndValidate(
            'PHP namespace (<vendor>\<name>) [' . static::suggestNamespace(static::$package) . ']:' . "\t",
            'Jumpstart\\Init::validateNamespace',
            null,
            static::suggestNamespace(static::$package)
        );
        static::$plugin_name = $io->ask(
            'Plugin Name [' . static::suggestPluginName(static::$package) . ']:' . "\t",
            static::suggestPluginName(static::$package)
        );
        static::$plugin_slug = $io->askAndValidate(
            'Plugin Slug [' . static::suggestPluginSlug(static::$plugin_name) . ']:' . "\t",
            'Jumpstart\\Init::validateSlug',
            null,
            static::suggestPluginSlug(static::$plugin_name)
        );
        static::$version = $io->askAndValidate(
            'Version (x.x.x) [1.0.0]:' . "\t",
            'Jumpstart\\Init::validateVersion',
            null,
            '1.0.0'
        );
        static::$description = $io->askAndValidate(
            'Description []:' . "\t",
            'Jumpstart\\Init::validateDescription',
            null,
            ''
        );
        static::$url = $io->askAndValidate(
            'URL []:' . "\t",
            'Jumpstart\\Init::validateURL'
        );
        static::$author = $io->ask(
            'Author [' . static::suggestAuthor() . ']:' . "\t",
            static::suggestAuthor()
        );
        static::$author_email = $io->ask(
            'Author Email [' . static::suggestAuthorEmail() . ']:' . "\t",
            static::suggestAuthorEmail()
        );
        static::$author_url = $io->askAndValidate(
            'Author URL []:' . "\t",
            'Jumpstart\\Init::validateURL'
        );
        static::$license = $io->ask(
            'License [' . static::suggestLicense() . ']:' . "\t",
            static::suggestLicense()
        );

        return array(
            'package' => static::$package,
            'namespace' => static::$namespace,
            'plugin_name' => static::$plugin_name,
            'plugin_slug' => static::$plugin_slug,
            'version' => static::$version,
            'description' => static::$description,
            'url' => static::$url,
            'author' => static::$author,
            'author_email' => static::$author_email,
            'author_url' => static::$author_url,
            'license' => static::$license,
        );
    }
993281
public function getHooks(string $event): array
	{
		return isset(static::$traitHooks[static::class][$event]) ? $this->bindHooks(static::$traitHooks[static::class][$event]) : [];
	}
651223
public function render(Event $event)
    {
        $formatter = $this->getFormatter();

        $arguments = [
            $event->getInstance(),
            $formatter->renderEscape($event->getTrigger()),
            $event->getHandle(),
        ];

        if ($this->hasCapture()) {
            $arguments[] = $formatter->renderEscape($event->isCapture());
        }

        return $formatter->renderObjectAssignment($event, $formatter->renderCall(
            $formatter->renderProperty($formatter->renderClass('event'), $this->getMethod()),
            $arguments
        ));
    }
246301
public function settingsDefaults(Event $event)
    {
        return [
            'visibility' => 0,
            'auto_approve' => false,
            'allow_anonymous' => false,
            'anonymous_name' => false,
            'anonymous_name_required' => true,
            'anonymous_email' => false,
            'anonymous_email_required' => true,
            'anonymous_web' => false,
            'anonymous_web_required' => true,
            'text_processing' => 'plain',
            'use_ayah' => false,
            'ayah_publisher_key' => '',
            'ayah_scoring_key' => '',
            'use_akismet' => false,
            'akismet_key' => '',
            'akismet_action' => 'mark',
        ];
    }
625964
protected function getSortedListeners($event)
    {
        if (! $this->hasListeners($event)) {
            return [];
        }

        $listeners = $this->listeners[$event] ?? [];

        if ($event !== '*') {
            $namesWithWildcard = array_filter(array_keys($this->listeners), function ($name) {
                return $name !== '*' && strpos($name, '*') !== false;
            });
            foreach ($namesWithWildcard as $name) {
                if (StringHelper::matchWildcard('*', $name)) {
                    $listeners = array_merge($listeners, $this->listeners[$name]);
                }
            }
        }

        if (empty($listeners)) {
            return [];
        }

        krsort($listeners);

        return call_user_func_array('array_merge', $listeners);
    }
872659
protected function collectListeners($event, array $args=[])
    {
        $event = $this->eventToString($event);

        $listeners = [];

        // Build args for * listeners
        array_unshift($args, $event);

        foreach ($this->root->getListeners('*', 'before') as $listener) {
            $listeners[] = function () use ($listener, $event, &$args) {
                return $this->callListener($listener, $event, $args);
            };
        }

        foreach ($this->root->getListeners($event, 'before') as $listener) {
            $listeners[] = $listener;
        }

        foreach ($this->root->getListeners($event) as $listener) {
            $listeners[] = $listener;
        }

        foreach ($this->root->getListeners('*') as $listener) {
            $listeners[] = function () use ($listener, $event, &$args) {
                return $this->callListener($listener, $event, $args);
            };
        }

        foreach ($this->root->getListeners($event, 'after') as $listener) {
            $listeners[] = $listener;
        }

        foreach ($this->root->getListeners('*', 'after') as $listener) {
            $listeners[] = function () use ($listener, $event, &$args) {
                return $this->callListener($listener, $event, $args);
            };
        }

        return $listeners;
    }
155805
protected function getBindings(string $event) {
        if (!isset($this->bindings[$event]) || !is_array($this->bindings[$event])) {
            return [];
        }
        return $this->bindings[$event];
    }
1265373
public function getWidgets(Event $event): void
    {
        $result = array_merge(
            (array)$event->result,
            $this->getSavedSearchWidgets(),
            $this->getReportWidgets(),
            $this->getAppWidgets()
        );

        $event->result = array_filter($result);
    }
1349859
protected function getParentListeners($event)
    {
        $parentListeners = [];

        foreach ($this->listeners as $key => $listeners)
        {
            if ($event instanceof $key)
            {
                $parentListeners = array_merge($parentListeners, $listeners);
            }
        }

        return $parentListeners;
    }
1164538
protected function getSortedListeners($event)
    {
        if (! $this->hasListeners($event)) {
            return [];
        }

        $listeners = $this->listeners[$event];
        krsort($listeners);

        return call_user_func_array('array_merge', $listeners);
    }
1317706
public function afterFilter(Event $event)
    {
        $pluginEvent = Plugin::getData('Core', 'Controller.afterFilter');
        if (is_callable($pluginEvent->find(0)) && Plugin::hasManifestEvent('Controller.afterFilter')) {
            call_user_func_array($pluginEvent->find(0), [$this, $event]);
        }
    }
728172
public function getArgs($event)
    {
        return [
            $event->getHref(),
            $event->getLabel(),
            $event->getTitle(),
            $event->getClass(),
            $event->getAttributes(),
            $event->getEnvironment()->getDataDefinition()->getName(),
            $event->getEnvironment()->getDataDefinition()->getBasicDefinition()->getRootEntries()
        ];
    }
786417
private function getEventNameParts($event) {
        $parts = ['*'];
        $offset = 0;

        while ($offset = strpos($event, '.', $offset + 1)) {
            $parts[] = substr($event, 0, $offset) . '.*';
        }

        $parts[] = $event;

        return $parts;
    }
374640
public function col_context($event) {
        // Add context name.
        if ($event->contextid) {
            // If context name was fetched before then return, else get one.
            if (isset($this->contextname[$event->contextid])) {
                return $this->contextname[$event->contextid];
            } else {
                $context = context::instance_by_id($event->contextid, IGNORE_MISSING);
                if ($context) {
                    $contextname = $context->get_context_name(true);
                    if ($url = $context->get_url()) {
                        $contextname = html_writer::link($url, $contextname);
                    }
                } else {
                    $contextname = get_string('other');
                }
            }
        } else {
            $contextname = get_string('other');
        }

        $this->contextname[$event->contextid] = $contextname;
        return $contextname;
    }
440044
protected function getEventBlocks(BlockEvent $event)
    {
        $results = [];

        foreach ($event->getBlocks() as $block) {
            $results[] = [$block->getId(), $block->getType()];
        }

        return $results;
    }
1006918
public function getRecipients($event)
    {
        $groupIds = $this->Groups()->column('ID');
        if (count($groupIds)) {
            $members = Member::get()->filter('Groups.ID', $groupIds);
            return $members;
        }
        return [];
    }
750795
private function captureStepEvent(Event $event)
    {
        if ($event instanceof AfterStepTested) {
            $this->afterStepTestedEvents[$event->getStep()->getLine()] = $event;
        }
        if ($event instanceof AfterStepSetup) {
            $this->afterStepSetupEvents[$event->getStep()->getLine()] = $event;
        }
    }