Clockwork\Support\Laravel\ClockworkSupport::process PHP Метод

process() публичный Метод

public process ( $request, $response )
    public function process($request, $response)
    {
        if (!$this->isCollectingData()) {
            return $response;
            // Collecting data is disabled, return immediately
        }
        // don't collect data for configured URIs
        $request_uri = $request->getRequestUri();
        $filter_uris = $this->getConfig('filter_uris', []);
        $filter_uris[] = '/__clockwork/[0-9\\.]+';
        // don't collect data for Clockwork requests
        foreach ($filter_uris as $uri) {
            $regexp = '#' . str_replace('#', '\\#', $uri) . '#';
            if (preg_match($regexp, $request_uri)) {
                return $response;
            }
        }
        $this->app['clockwork.laravel']->setResponse($response);
        $this->app['clockwork']->resolveRequest();
        $this->app['clockwork']->storeRequest();
        if (!$this->isEnabled()) {
            return $response;
            // Clockwork is disabled, don't set the headers
        }
        $response->headers->set('X-Clockwork-Id', $this->app['clockwork']->getRequest()->id, true);
        $response->headers->set('X-Clockwork-Version', Clockwork::VERSION, true);
        if ($request->getBasePath()) {
            $response->headers->set('X-Clockwork-Path', $request->getBasePath() . '/__clockwork/', true);
        }
        $extra_headers = $this->getConfig('headers', []);
        foreach ($extra_headers as $header_name => $header_value) {
            $response->headers->set('X-Clockwork-Header-' . $header_name, $header_value);
        }
        return $response;
    }