Sets request metrics from a handler
@param \Google_Service_AnalyticsReporting_ReportRequest $request
@param array $handler
199139
protected function setRequestMetrics($request, array $handler)
    {
        if (empty($handler['query']['metrics'])) {
            throw new OutOfRangeException('No query metrics data found in the handler');
        }

        $metrics = array();

        foreach ((array) $handler['query']['metrics'] as $i => $name) {
            $metric = new \Google_Service_AnalyticsReporting_Metric;
            $metric->setExpression($name);
            $metrics[] = $metric;
        }

        $request->setMetrics($metrics);
    }
71462
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
        {
            $cookies  = $request->getCookieParams();
            $name     = $this->name ?: session_name();
            $id       = $cookies[$name] ?? bin2hex(random_bytes(16));
            $options  = $this->options;
            $session  = $this->session->start($id, $name, $options);
            
            $request  = $request->withAttribute($this->sessionRequestAttribute, $session);
            $response = $handler->handle($request);
            $session->save();
            
            return isset($cookies[$name]) ? $response : $response->withHeader(
                'Set-Cookie',
                sprintf(
                    "%s=%s; path=%s", 
                    $name, 
                    $id, 
                    ini_get('session.cookie_path')
                )
            );
        }
1210485
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $packer = service_packer();
        $data   = $request->getAttribute(self::ATTRIBUTE_DATA);
        $data   = $packer->unpack($data);

        // init data and trigger event
        App::trigger(RpcServerEvent::BEFORE_RECEIVE, null, $data);
        $request = $request->withAttribute(self::ATTRIBUTE_DATA, $data);

        /* @var \Swoft\Rpc\Server\Rpc\Response $response */
        $response      = $handler->handle($request);
        $serviceResult = $response->getAttribute(HandlerAdapter::ATTRIBUTE);
        $serviceResult = $packer->pack($serviceResult);

        return $response->withAttribute(HandlerAdapter::ATTRIBUTE, $serviceResult);
    }
38023
static function set_error_logger( $handler ){
		if( ! is_callable($handler) ){
			trigger_error( 'Error logging handler is not callable ('.var_export($handler,1).')', E_USER_WARNING );
			return false;
		}
		PLUGError::$logfunc = $handler;
		return true;
	}
1056894
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        // Use an array cache for database calls, etc.
        app()->instance('cache.array', new Repository(new ArrayStore()));

        return $handler->handle($request);
    }
1326661
public function setHandler(MultiResponseHandlerInterface $handler = null):MultiRequest {

		if(!$handler){

			if(!class_exists($this->options->handler)){
				throw new RequestException('no handler set');
			}

			$handler = new $this->options->handler($this);

			if(!is_a($handler, MultiResponseHandlerInterface::class)){
				throw new RequestException('handler is not a MultiResponseHandlerInterface');
			}

		}

		$this->multiResponseHandler = $handler;

		return $this;
	}
411671
public function process(Request $request, Handler $handler): Response
    {
        try {
            return $handler->handle($request);
        } catch (Throwable $e) {
            if ($e->getCode() !== 404) {
                $this->logger->error($e);
            }

            return WhoopsRunner::handle($e, $request);
        }
    }
1049695
public function process(Request $request, Handler $handler): Response
    {
        $method = $request->getMethod();
        $uri = $request->getUri()->getPath() ?: '/';

        $routeInfo = $this->getDispatcher()->dispatch($method, $uri);

        switch ($routeInfo[0]) {
            case Dispatcher::NOT_FOUND:
                throw new RouteNotFoundException($uri);
            case Dispatcher::METHOD_NOT_ALLOWED:
                throw new MethodNotAllowedException($method);
            case Dispatcher::FOUND:
                $handler = $routeInfo[1];
                $parameters = $routeInfo[2];

                return $handler($request, $parameters);
        }
    }
1341026
public function addHandler($name, $handler)
    {
        $tmp        = $this->relationHandlers->getValue($this->entity);
        $tmp[$name] = $handler;
        $this->relationHandlers->setValue($this->entity, $tmp);
    }
74158
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $route = $this->routerDispatcher->dispatch($request);
        if (count($route->getAttributes())) {
            foreach ($route->getAttributes() as $key => $value) {
               $request = $request->withAttribute($key, $value);
            }
        }
        $request = $request->withAttribute('route', $route);

        return $handler->handle($request);
    }
233054
public function process(RequestInterface $request, RequestHandlerInterface $handler)
    {
        $response = $handler->handle($request);

        $response->body()->write('World!');

        return $response;
    }
762810
public function handleRequest($request = null)
    {
        $this->submitted = true;

        $requestData = $this->requestHandler->handleRequest($this, $request);

        $validRequestData = $this->checkFieldsSubmitted($this->fields, $requestData);

        if ($this->submitted === true && !empty($validRequestData)) {
            $this->data = $validRequestData;
            $this->setRequiredFieldErrors();
        }
        else {
            $this->submitted = false;
        }

        if (isset($this->restoreDataHandler)) {
            if ($this->isSubmitted()) {
                $this->restoreDataHandler->setRestorableData($this, $this->data, $request);
            }
            else {
                $restoredData = $this->restoreDataHandler->restoreData($this, $request);

                if (is_array($restoredData) && !empty($restoredData)) {
                    $this->data = $restoredData;
                }
            }
        }

        if (isset($this->eventDispatcher)) {
            $event = new FormHandlerRequestEvent($this, $request, $this->data);
            $this->eventDispatcher->dispatch('form_handler.request', $event);
            $this->data = $event->getFormData();
        }
    }
853978
private function load_handler_as_static($handler) {
	list($class, $method) = explode('::', $handler);
	
	$class::$method($this->url, $this->method, $this->arguments);
}
775870
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $ip = $this->getIp($request);

        if (!empty($ip)) {
            $address = $this->getAddress($ip);
            $request = $request->withAttribute($this->attribute, $address);
        }

        return $handler->handle($request);
    }
393286
public function handle( $handler = '' ) {
		if ( ! empty( $handler ) ) {
			$this->attribute( 'handler', $handler );
		}

		$this->router->addRoute( $this->router->route( $this->getAttributes() ) );
	}
998848
public function setRequestOnHandler($request)
    {
        if ($this->handlerNeedsRequest()) {
            /** @var NeedRequestInterface $handler */
            $handler = $this->getHandler();
            $handler->setRequest($request);
        }
    }
813177
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $route = $request->getAttribute('_route');
        if( ! $route || ! ($handler instanceof \Sherpa\Kernel\RequestHandler\RequestHandler) ) {
            return $handler->handle($request);
        }
        foreach($route->getMiddlewares() as $m) {
            $handler->getMiddlewareGroup()->addMiddleware($m['middleware'], $m['priority'], $m['before']);
        }

        return $handler->handle($request);
    }