Sets request date range
@param \Google_Service_AnalyticsReporting_ReportRequest $request
@param array $handler
540372
protected function setRequestDate($request, array $handler)
    {
        if (!empty($handler['query']['date']) && count($handler['query']['date']) == 2) {

            list($from, $to) = $handler['query']['date'];

            $date = new \Google_Service_AnalyticsReporting_DateRange;
            $date->setStartDate($from);
            $date->setEndDate($to);

            $request->setDateRanges($date);
        }
    }
835147
private void addQueryParams(final Request request) {
        if (dateCreatedAfter != null) {
            request.addQueryParam("DateCreatedAfter", dateCreatedAfter.toString());
        }

        if (dateCreatedBefore != null) {
            request.addQueryParam("DateCreatedBefore", dateCreatedBefore.toString());
        }

        if (track != null) {
            request.addQueryParam("Track", track.toString());
        }

        if (publisher != null) {
            request.addQueryParam("Publisher", publisher.toString());
        }

        if (kind != null) {
            request.addQueryParam("Kind", kind.toString());
        }

        if (getPageSize() != null) {
            request.addQueryParam("PageSize", Integer.toString(getPageSize()));
        }
    }
995797
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $begin = microtime(true);
        $response = $handler->handle($request);
        $end = microtime(true);

        $message = $this->format;
        $message = $this->replaceConstantDirectives($message, $request, $response, $begin, $end);
        $message = $this->replaceVariableDirectives($message, $request, $response, $begin, $end);

        $context = [];

        if ($this->context !== null) {
            $contextFunction = $this->context;
            $context = $contextFunction($request, $response);
        }

        $statusCode = $response->getStatusCode();

        if ($statusCode >= 400 && $statusCode < 500) {
            $this->logger->warning($message, $context);
        } elseif ($statusCode >= 500 && $statusCode < 600) {
            $this->logger->error($message, $context);
        } else {
            $this->logger->info($message, $context);
        }

        return $response;
    }
167884
private function setRequest(Request $request = null)
    {
        $this->request = $request;
        $this->override = null;
    }
1059404
public function setRequestsPerTimeSpan($requests)
    {
        if (!is_numeric($requests)) {
            throw new InvalidArgumentException('requests per timespan is not numeric');
        }
        $requests = (int) $requests;
        if ($requests < 1) {
            throw new InvalidArgumentException('requests per timespan cannot be smaller than 1');
        }
        $this->requestsPerTimeSpan = $requests;
    }
1208318
private void addQueryParams(final Request request) {
        if (absoluteDateCreated != null) {
            request.addQueryParam("DateCreated", absoluteDateCreated.toString(Request.QUERY_STRING_DATE_FORMAT));
        } else if (rangeDateCreated != null) {
            request.addQueryDateRange("DateCreated", rangeDateCreated);
        }

        if (getPageSize() != null) {
            request.addQueryParam("PageSize", Integer.toString(getPageSize()));
        }
    }
4122
public function request(array $settings, array $handler)
    {
        if (empty($settings['ga_profile_id'])) {
            throw new OutOfRangeException('Google Analytics profile ID is empty in the request settings');
        }

        $service = $this->getService($settings); // Also loads all needed libraries

        $request = new \Google_Service_AnalyticsReporting_ReportRequest;
        $request->setViewId($settings['ga_profile_id']);

        $this->setRequestDate($request, $handler);
        $this->setRequestMetrics($request, $handler);
        $this->setRequestSorting($request, $handler);
        $this->setRequestDimensions($request, $handler);

        $body = new \Google_Service_AnalyticsReporting_GetReportsRequest;
        $body->setReportRequests(array($request));

        return $service->reports->batchGet($body);
    }
521139
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $route = $this->router->dispatch($request->getMethod(), rawurldecode($request->getUri()->getPath()));

        if ($route[0] === Dispatcher::NOT_FOUND) {
            return $this->createResponse(404);
        }

        if ($route[0] === Dispatcher::METHOD_NOT_ALLOWED) {
            return $this->createResponse(405)->withHeader('Allow', implode(', ', $route[1]));
        }

        foreach ($route[2] as $name => $value) {
            $request = $request->withAttribute($name, $value);
        }

        $request = $this->setHandler($request, $route[1]);

        return $handler->handle($request);
    }
511611
private function record(Request $request, string $event)
    {
        $this->traces[$this->getTraceKey($request)][] = $event;
    }
1276629
protected function setRequestDimensions($request, array $handler)
    {
        if (!empty($handler['query']['dimensions'])) {

            $dimensions = array();

            foreach ((array) $handler['query']['dimensions'] as $name) {
                $dimension = new \Google_Service_AnalyticsReporting_Dimension;
                $dimension->setName($name);
                $dimensions[] = $dimension;
            }

            $request->setDimensions($dimensions);
        }
    }
394618
private void addQueryParams(final Request request) {
        if (log != null) {
            request.addQueryParam("Log", log.toString());
        }

        if (absoluteMessageDate != null) {
            request.addQueryParam("MessageDate", absoluteMessageDate.toString(Request.QUERY_STRING_DATE_FORMAT));
        } else if (rangeMessageDate != null) {
            request.addQueryDateRange("MessageDate", rangeMessageDate);
        }

        if (getPageSize() != null) {
            request.addQueryParam("PageSize", Integer.toString(getPageSize()));
        }
    }
672927
function setExceptionHandler(callable $handler)
    {
        $ExceptionHandler = new TransferHandle;
        $ExceptionHandler->setWhoopsHandle($handler);
        $this->container->set(SysConst::HTTP_EXCEPTION_HANDLER, $ExceptionHandler);
    }
1156021
protected function setPagerListReportEvent()
    {
        $conditions = $this->query_filter;
        $conditions['count'] = true;

        $pager = array(
            'query' => $this->query_filter,
            'total' => (int) $this->report->getList($conditions)
        );

        return $this->data_limit = $this->setPager($pager);
    }
517429
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        return $this->execute([$request, $handler]);
    }
1212741
private void addQueryParams(final Request request) {
        if (dateCreatedFrom != null) {
            request.addQueryParam("DateCreatedFrom", dateCreatedFrom.toString());
        }

        if (dateCreatedTo != null) {
            request.addQueryParam("DateCreatedTo", dateCreatedTo.toString());
        }

        if (getPageSize() != null) {
            request.addQueryParam("PageSize", Integer.toString(getPageSize()));
        }
    }
279601
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $serviceHandler = $request->getAttribute(RouterMiddleware::ATTRIBUTE);

        /* @var \Swoft\Rpc\Server\Router\HandlerAdapter $handlerAdapter */
        $handlerAdapter = App::getBean('serviceHandlerAdapter');
        $response       = $handlerAdapter->doHandler($request, $serviceHandler);

        return $response;
    }
1084854
public function setDebug($debug, $handler = null)
    {
        $this->debug         = $debug;
        $this->debug_handler = $handler;
    }