original_string: public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
      {
          $httpHandler = $request->getAttribute(AttributeEnum::ROUTER_ATTRIBUTE);
          $info = $httpHandler[2];
  
          $actionMiddlewares = [];
          if (isset($info['handler']) && \is_string($info['handler'])) {
              // Extract action info from router handler
              $exploded             = explode('@', $info['handler']);
              $controllerClass      = $exploded[0] ?? '';
              $action               = $exploded[1] ?? '';
  
              $collector = MiddlewareCollector::getCollector();
              $collectedMiddlewares = $collector[$controllerClass]['middlewares']??[];
  
              // Get group middleware from Collector
              if ($controllerClass) {
                  $collect = $collectedMiddlewares['group'] ?? [];
                  $collect && $actionMiddlewares = array_merge($actionMiddlewares, $collect);
              }
              // Get the specified action middleware from Collector
              if ($action) {
                  $collect = $collectedMiddlewares['actions'][$action]??[];
                  $collect && $actionMiddlewares = array_merge($actionMiddlewares, $collect ?? []);
              }
          }
          if (!empty($actionMiddlewares) && $handler instanceof RequestHandler) {
              $handler->insertMiddlewares($actionMiddlewares);
          }
  
          return $handler->handle($request);
      }
code: public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
      {
          $httpHandler = $request->getAttribute(AttributeEnum::ROUTER_ATTRIBUTE);
          $info = $httpHandler[2];
  
          $actionMiddlewares = [];
          if (isset($info['handler']) && \is_string($info['handler'])) {
              // Extract action info from router handler
              $exploded             = explode('@', $info['handler']);
              $controllerClass      = $exploded[0] ?? '';
              $action               = $exploded[1] ?? '';
  
              $collector = MiddlewareCollector::getCollector();
              $collectedMiddlewares = $collector[$controllerClass]['middlewares']??[];
  
              // Get group middleware from Collector
              if ($controllerClass) {
                  $collect = $collectedMiddlewares['group'] ?? [];
                  $collect && $actionMiddlewares = array_merge($actionMiddlewares, $collect);
              }
              // Get the specified action middleware from Collector
              if ($action) {
                  $collect = $collectedMiddlewares['actions'][$action]??[];
                  $collect && $actionMiddlewares = array_merge($actionMiddlewares, $collect ?? []);
              }
          }
          if (!empty($actionMiddlewares) && $handler instanceof RequestHandler) {
              $handler->insertMiddlewares($actionMiddlewares);
          }
  
          return $handler->handle($request);
      }
code_tokens: public function process ( ServerRequestInterface $ request , RequestHandlerInterface $ handler ) : ResponseInterface { $ httpHandler = $ request -> getAttribute ( AttributeEnum :: ROUTER_ATTRIBUTE ) ; $ info = $ httpHandler [ 2 ] ; $ actionMiddlewares = [ ] ; if ( isset ( $ info [ 'handler' ] ) && \ is_string ( $ info [ 'handler' ] ) ) { // Extract action info from router handler $ exploded = explode ( '@' , $ info [ 'handler' ] ) ; $ controllerClass = $ exploded [ 0 ] ?? '' ; $ action = $ exploded [ 1 ] ?? '' ; $ collector = MiddlewareCollector :: getCollector ( ) ; $ collectedMiddlewares = $ collector [ $ controllerClass ] [ 'middlewares' ] ?? [ ] ; // Get group middleware from Collector if ( $ controllerClass ) { $ collect = $ collectedMiddlewares [ 'group' ] ?? [ ] ; $ collect && $ actionMiddlewares = array_merge ( $ actionMiddlewares , $ collect ) ; } // Get the specified action middleware from Collector if ( $ action ) { $ collect = $ collectedMiddlewares [ 'actions' ] [ $ action ] ?? [ ] ; $ collect && $ actionMiddlewares = array_merge ( $ actionMiddlewares , $ collect ?? [ ] ) ; } } if ( ! empty ( $ actionMiddlewares ) && $ handler instanceof RequestHandler ) { $ handler -> insertMiddlewares ( $ actionMiddlewares ) ; } return $ handler -> handle ( $ request ) ; }
docstring: do middlewares of action
  
  @param \Psr\Http\Message\ServerRequestInterface     $request
  @param \Psr\Http\Server\RequestHandlerInterface $handler
  
  @return \Psr\Http\Message\ResponseInterface
docstring_tokens: do middlewares of action