public function events(Request $request): array
    {
        /** @var \Swoft\Event\Manager\EventManager $em */
        $em = \bean('eventManager');

        if ($event = \trim($request->query('name'))) {
            if (!$queue = $em->getListenerQueue($event)) {
                return ['msg' => 'event name is invalid: ' . $event];
            }

            $classes = [];
            foreach ($queue->getIterator() as $listener) {
                $classes[] = \get_class($listener);
            }

            return $classes;
        }

        return $em->getListenedEvents();
    }