src/Http/Controller/AppController.php
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();
    }
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();
    }
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 ( ) ; }
Get all registered application events list
@RequestMapping(route="events", method=RequestMethod::GET)
@param Request $request
@return array
@throws \Throwable
Get all registered application events list