getStatisticsRequest: Build GetStatistics's request
@link https://docs.qingcloud.com/qingstor/api/bucket/get_stats.html Documentation URL

@return Request
489695
public function getStatisticsRequest()
    {
        $operation = array(
            'API' => 'GetBucketStatistics',
            'Method' => 'GET',
            'Uri' => '/<bucket-name>?stats',
            'Headers' => array(
                'Host' => $this->properties['zone'] . '.' . $this->config->host,
            ),
            'Params' => array(
            ),
            'Elements' => array(
            ),
            'Properties' => $this->properties,
            'Body' => null
        );
        $this->getStatisticsValidate($operation);
        $req = new Request($this->config, $operation);
        return $req;
    }
1245005
private function urlStatDirectory()
    {
        $stats = [];
        // 1. try to look up the directory as a file
        try {
            $this->object = $this->bucket->object($this->file);
            $info = $this->object->info();

            // equivalent to 40777 and 40444 in octal
            $stats['mode'] = $this->bucket->isWritable()
                ? self::DIRECTORY_WRITABLE_MODE
                : self::DIRECTORY_READABLE_MODE;
            $this->statsFromFileInfo($info, $stats);

            return $this->makeStatArray($stats);
        } catch (NotFoundException $e) {
        } catch (ServiceException $e) {
            return false;
        }

        // 2. try list files in that directory
        try {
            $objects = $this->bucket->objects([
                'prefix' => $this->file,
            ]);

            if (!$objects->current()) {
                // can't list objects or doesn't exist
                return false;
            }
        } catch (ServiceException $e) {
            return false;
        }

        // equivalent to 40777 and 40444 in octal
        $mode = $this->bucket->isWritable()
            ? self::DIRECTORY_WRITABLE_MODE
            : self::DIRECTORY_READABLE_MODE;
        return $this->makeStatArray([
            'mode'    => $mode
        ]);
    }
345474
private GetMetricStatisticsRequest buildRequest(String bucketName,
                                                    String metricName,
                                                    String storageType) {
        GetMetricStatisticsRequest request = new GetMetricStatisticsRequest();
        request.setMetricName(metricName);
        request.setNamespace("AWS/S3");
        request.setPeriod(360);
        request.setStatistics(Collections.singletonList("Maximum"));

        Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
        Date currentTime = cal.getTime();
        cal.add(Calendar.DATE, -1);
        request.setStartTime(cal.getTime());
        request.setEndTime(currentTime);

        List<Dimension> dimensions = new ArrayList<>();
        dimensions.add(new Dimension().withName("BucketName")
                                      .withValue(bucketName));
        dimensions.add(new Dimension().withName("StorageType")
                                      .withValue(storageType));
        request.setDimensions(dimensions);

        return request;
    }
1087660
protected function getStatistics() {
        if (!$this->_statistics) {
            $this->_statistics = new TaskStatisticsList(
                $this->version,
                $this->solution['assistantSid'],
                $this->solution['sid']
            );
        }

        return $this->_statistics;
    }
281245
protected function getAmount()
    {
        $request = $this->getRequest();
        return !is_null($request->getRequestParameter(self::MC_GROSS)) ? abs($request->getRequestParameter(self::MC_GROSS)) : null;
    }
67781
public function statsAction()
    {
        $om = $this->getObjectManager();
        $repository = $om->getRepository('TamagoTipsManagerBundle:TamagoTransUnitMeta');
        $stats = $repository->stats();

        return $this->render('TamagoTipsManagerBundle:Default:stats.html.twig', ['stats' => $stats]);
    }
1347065
public function getStats()
    {
        if (null !== $this->errorStack) {
            throw new \RuntimeException(sprintf(
                'Cannot retrieve stats when an exception was encountered ([%s] %s)',
                $this->errorStack->getTop()->getClass(),
                $this->errorStack->getTop()->getMessage()
            ));
        }

        if (false === $this->computed) {
            throw new \RuntimeException(
                'No statistics have yet been computed for this iteration set (::computeStats should be called)'
            );
        }

        return $this->stats;
    }
751140
public function stats()
    {
        return new Query\Stats($this->mongo, $this->entity, $this->ref, $this->dateRange);
    }
1268247
public function getRequestParameters()
    {
        // $page current page of the grid
        $page = (int) $this->getRequest()->get('page', 0);
        
        // $orderBy column name to sort datagrid records
        $orderBy = $this->getRequest()->get('sidx', false);
        
        // ASC | DESC $sort
        $sort = strtoupper($this->getRequest()->get('sord', 'asc'));
        
        // $records  number of records to display
        $records = (int) $this->getRequest()->get('rows', 0);
        
        // $search is search in the query
        $search = ($this->getRequest()->get('_search', false) === 'true');
 
        // $filters Filters from the search query
        $filters = (array) json_decode($this->getRequest()->get('filters', '{}'));
        
        // $masterRowId Id of the master grid record
        $masterGridRowId = (int) $this->getRequest()->get('masterGridRowId', 0);
        
        $parameters = array(
            'page'            => $page,
            'orderBy'         => $orderBy,
            'sort'            => $sort,
            'records'         => $records,
            'search'          => $search,
            'filters'         => $filters,
            'masterGridRowId' => $masterGridRowId
        );
        
        return $parameters;
    }
469640
protected function getApiRoot()
    {
        $request = $this->requestStack->getMasterRequest();
        $pathinfo = $request->getPathInfo();
        $semanticPathinfo = $request->attributes->get('semanticPathinfo', $pathinfo);

        return $request->getBaseUrl() . substr($pathinfo, 0, strpos($pathinfo, $semanticPathinfo)) . '/';
    }
986604
private function getMetrics()
    {
        $metrics = [
            $this->metricFactory->create(
                ['name' => 'unique_sessions', 'field' => 'session.uid', 'type' => MetricInterface::TYPE_CARDINALITY]
            ),
            $this->metricFactory->create(
                ['name' => 'unique_visitors', 'field' => 'session.vid', 'type' => MetricInterface::TYPE_CARDINALITY]
            ),
            $this->metricFactory->create(
                ['name' => 'spellcheck_usage', 'field' => 'page.search.is_spellchecked', 'type' => MetricInterface::TYPE_STATS]
            ),
        ];

        return $metrics;
    }
166861
public function stream_stat()
    {
        $statistics = $this->fileStatisticsTemplate();

        if ($this->_download !== null) {
            $statistics[7] = $statistics['size'] = $this->_download->getSize();
        }
        if ($this->_upload !== null) {
            $statistics[7] = $statistics['size'] = $this->_pointerOffset;
        }

        return $statistics;
    }
1003730
public function getDataAction()
    {
        $request           = $this->getRequest();
        $dataCount         = 0;
        $dataFilteredCount = 0;
        $tableData         = array();
        $draw              = 0;
        if($request->isPost()) {

            $post           = get_object_vars($request->getPost());
            $columns        = array_keys($this->tool()->getColumns());
            $draw           = (int) $post['draw'];
            $selColOrder    = $columns[(int) $post['order'][0]['column']];
            $orderDirection = isset($post['order']['0']['dir']) ? strtoupper($post['order']['0']['dir']) : 'ASC';
            $searchValue    = isset($post['search']['value']) ? $post['search']['value'] : null;
            $searchableCols = $this->tool()->getSearchableColumns();
            $start          = (int) $post['start'];
            $length         = (int) $post['length'];

            $data              = $this->themeTable()->getData($searchValue, $searchableCols, $selColOrder, $orderDirection, $start, $length)->toArray();
            $dataCount         = $this->themeTable()->getTotalData();
            $dataFilteredCount = $this->themeTable()->getTotalFiltered();
            $tableData         = $data;

            for($ctr = 0; $ctr < count($tableData); $ctr++) {
                // apply text limits
                foreach($tableData[$ctr] as $vKey => $vValue) {
                    $tableData[$ctr][$vKey] = $this->tool()->limitedText($vValue, 80);
                }

                $tableData[$ctr]['DT_RowId'] = $tableData[$ctr]['pros_theme_id'];
            }
        }

        $response = [
            'draw'            => $draw,
            'data'            => $tableData,
            'recordsFiltered' => $dataFilteredCount,
            'recordsTotal'    => $dataCount
        ];

        return new JsonModel($response);
    }
215241
public function getData()
    {
        $serviceRoute = $this->requestStack->getCurrentRequest()
                                           ->get('service');

        // Locate the model definition
        $model = $this->getAnalyticModel($serviceRoute);

        $cacheTime = $model->getCacheTime();
        $cacheKey = $this->getCacheKey($model);

        //Cached data if configured
        if ($cacheTime &&
            !$this->requestStack->getCurrentRequest()->headers->has($this->skipCacheHeaderName) &&
            $cache = $this->cacheProvider->fetch($cacheKey)
        ) {
            return $cache;
        }

        $data = $this->analyticsManager->getData($model, $this->getServiceParameters($model));

        if ($cacheTime) {
            $this->cacheProvider->save($cacheKey, $data, $cacheTime);
        }

        return $data;
    }
693952
public function stats() {
		$res = [];

		$query = $this->find();
		$list = $query
			->select(['count' => $query->count(), 'country_id'])
			->group('country_id')
			->hydrate(false)
			->all();

		foreach ($list as $x) {
			$res[$x['country_id']] = (int)$x['count'];
		}

		return $res;
	}
1131378
protected function getStatistics() {
        if (!$this->_statistics) {
            $this->_statistics = new WorkflowStatisticsList(
                $this->version,
                $this->solution['workspaceSid'],
                $this->solution['sid']
            );
        }

        return $this->_statistics;
    }
1216251
public function headRequest()
    {
        $operation = array(
            'API' => 'HeadBucket',
            'Method' => 'HEAD',
            'Uri' => '/<bucket-name>',
            'Headers' => array(
                'Host' => $this->properties['zone'] . '.' . $this->config->host,
            ),
            'Params' => array(
            ),
            'Elements' => array(
            ),
            'Properties' => $this->properties,
            'Body' => null
        );
        $this->headValidate($operation);
        $req = new Request($this->config, $operation);
        return $req;
    }