@param Request $request
@param object $processor

@return mixed
488755
public function processLimit(Request $request, $processor)
    {
        if ( ! is_null($limit = $this->limitObtainer->get($request)) and
            $processor instanceof Limit\ProcessStrategy) {

            return $processor->limit(
                $this->limitParser->parse($limit)
            );
        }
    }
22190
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $middlewares = $this->module_service->findByInterface(MiddlewareInterface::class);

        $pipeline = $handler;

        foreach ($middlewares as $middleware) {
            $pipeline = new class($pipeline, $middleware) implements RequestHandlerInterface {
                /** @var RequestHandlerInterface */
                private $handler;

                /** @var MiddlewareInterface */
                private $middleware;

                public function __construct(RequestHandlerInterface $handler, MiddlewareInterface $middleware)
                {
                    $this->handler    = $handler;
                    $this->middleware = $middleware;
                }

                public function handle(ServerRequestInterface $request): ResponseInterface
                {
                    return $this->middleware->process($request, $this->handler);
                }
            };
        }

        return $pipeline->handle($request);
    }
300834
public function setProcessor(string $processorId, callable $processor): self
    {
        $this->_processors[$processorId] = $processor;

        return $this;
    }
474177
public function process(Request $request, RequestHandlerInterface $delegate): ResponseInterface
    {
        try {
            return $delegate->handle($request);
        } catch (\Throwable $t) {
            return $this->handleException($t, $request);
        }
    }
281894
public function resolve($processor)
    {
        $middlewares = array($processor);

        foreach ($this->specs as $spec) {
            $args = $spec;
            $firstArg = array_shift($args);

            if (is_callable($firstArg)) {
                $processor = $firstArg($processor);
            } else {
                $kernelClass = $firstArg;
                array_unshift($args, $processor);

                $reflection = new \ReflectionClass($kernelClass);
                $processor = $reflection->newInstanceArgs($args);
            }

            array_unshift($middlewares, $processor);
        }

        return new StackedProcessor($processor, $middlewares);
    }
982965
protected function canProcessRequest(Request $request)
    {
        if ($request instanceof BatchRequest) {
            foreach ($request as $req) {
                if (!$this->isMethodSupported($req->getMethod())) {
                    return false;
                }
            }

            return true;
        }

        return $this->isMethodSupported($request->getMethod());
    }
1280770
public function process(HTTPRequest $request, callable $delegate)
    {
        /** @var HTTPResponse $response */
        $response = $delegate($request);
        if (!$response) {
            return null;
        }

        // Ignore etag for no-store
        $cacheControl = $response->getHeader('Cache-Control');
        if ($cacheControl && strstr($cacheControl, 'no-store')) {
            return $response;
        }

        // Generate, assign, and conditionally check etag
        $etag = $this->generateETag($response);
        if ($etag) {
            $response->addHeader('ETag', $etag);

            // Check if we have a match
            $ifNoneMatch = $request->getHeader('If-None-Match');
            if ($ifNoneMatch === $etag) {
                return $this->sendNotModified($request, $response);
            }
        }

        // Check If-Modified-Since
        $ifModifiedSince = $request->getHeader('If-Modified-Since');
        $lastModified = $response->getHeader('Last-Modified');
        if ($ifModifiedSince && $lastModified && strtotime($ifModifiedSince) >= strtotime($lastModified)) {
            return $this->sendNotModified($request, $response);
        }

        return $response;
    }
455441
public function process(HTTPRequest $request, callable $delegate)
    {
        /** @var HTTPResponse $response */
        $response = $delegate($request);

        // Ignore by regexes.
        if ($this->shouldCheckHttpHost() && $this->isIgnoredDomain($_SERVER['HTTP_HOST'])) {
            return $response;
        }

        foreach ($this->requestedPolicies as $requestedPolicy) {
            /** @var ControllerPolicy $policyInstance */
            $policyInstance = $requestedPolicy['policy'];

            $policyInstance->applyToResponse(
                $requestedPolicy['originator'],
                $request,
                $response
            );
        }

        return $response;
    }
611935
public function activate(Processor $processor, $type, $id)
    {
        return $processor->activate($this, $type, $id);
    }
798537
public static function unregisterProcessor($processor)
    {
        $processors = &self::processors();
        $key = array_search($processor, $processors, true);
        if ($key === false) {
            throw new Exception('Given processor was not registered');
        }
        unset($processors[$key]);
    }
672463
public function process(ServerRequestInterface $request, DelegateInterface $delegate)
    {
        $this->response = $delegate->process($request);
        $action = $this->action;

        return $action();
    }
722184
public static function getFromRequest(Request $request)
    {
        // if something has already set a page object, we return it
        $c = $request->getCurrentPage();
        if (is_object($c)) {
            return $c;
        }
        if ($request->getPath() != '') {
            $path = $request->getPath();
            $db = Database::connection();
            $cID = false;
            $ppIsCanonical = false;
            $site = \Core::make('site')->getSite();
            $treeIDs = [0];
            foreach($site->getLocales() as $locale) {
                $tree = $locale->getSiteTree();
                if (is_object($tree)) {
                    $treeIDs[] = $tree->getSiteTreeID();
                }
            }

            $treeIDs = implode(',', $treeIDs);

            while ((!$cID) && $path) {
                $row = $db->fetchAssoc('select pp.cID, ppIsCanonical from PagePaths pp inner join Pages p on pp.cID = p.cID where cPath = ? and siteTreeID in (' . $treeIDs . ')', [$path]);
                if (!empty($row)) {
                    $cID = $row['cID'];
                    if ($cID) {
                        $cPath = $path;
                        $ppIsCanonical = (bool) $row['ppIsCanonical'];
                        break;
                    }
                }
                $path = substr($path, 0, strrpos($path, '/'));
            }
            if ($cID && $cPath) {
                $c = self::getByID($cID, 'ACTIVE');
                $c->cPathFetchIsCanonical = $ppIsCanonical;
            } else {
                $c = new self();
                $c->loadError(COLLECTION_NOT_FOUND);
            }

            return $c;
        } else {
            $cID = $request->query->get('cID');
            if (!$cID) {
                $cID = $request->request->get('cID');
            }
            $cID = Core::make('helper/security')->sanitizeInt($cID);
            if ($cID) {
                $c = self::getByID($cID, 'ACTIVE');
            } else {
                $site = \Core::make('site')->getSite();
                $c = $site->getSiteHomePageObject('ACTIVE');
            }
            $c->cPathFetchIsCanonical = true;
        }

        return $c;
    }
874128
protected function doRequest(Request $request)
    {

        $this->client->send($request, $response = new Response());

        return $response;
    }
1373558
public function process(ServerRequestInterface $request, DelegateInterface $delegate)
    {
        $operation = $this->getOperation($request);

        foreach ($this->parameterAssembler->getRequestParameters($request, $operation) as $name => $value) {
            $request = $request->withAttribute($name, $value);
        }

        return $delegate->process($request);
    }
712379
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        return $this->pipeline->withRequest($request, function () use ($request, $handler): ResponseInterface {
            return $handler->handle($request);
        });
    }
1313223
protected function doRequestInProcess($request)
    {
        $process = new PhpProcess($this->getScript($request), null, null);
        $process->run();

        if (!$process->isSuccessful() || !preg_match('/^O\:\d+\:/', $process->getOutput())) {
            throw new \RuntimeException(sprintf('OUTPUT: %s ERROR OUTPUT: %s', $process->getOutput(), $process->getErrorOutput()));
        }

        return unserialize($process->getOutput());
    }
479594
public function logRequest(
        $request,
        $endpoint,
        $method,
        $reference = null,
        $processors = array()
    ) {
        $processedRequest = $this->processPayload($processors, $request);

        $apiCall = $this->apiCallFactory->create();
        $apiCall
            ->setRequest($processedRequest)
            ->setEndpoint($endpoint)
            ->setMethod($method)
            ->setReference($reference)
            ->setRequestTime(microtime(true))
        ;

        $this->handleApiCall($apiCall);

        return $apiCall;
    }