protected function setRequestSorting($request, array $handler)
    {
        if (!empty($handler['query']['sort'])) {

            $orders = array();
            foreach ((array) $handler['query']['sort'] as $field => $params) {

                $params += array('VALUE', 'ASCENDING');

                list($type, $direction) = array_map('strtoupper', $params);

                $order = new \Google_Service_AnalyticsReporting_OrderBy;

                $order->setFieldName($field);
                $order->setOrderType($type);
                $order->setSortOrder($direction);

                $orders[] = $order;
            }

            $request->setOrderBys($orders);
        }
    }
protected function setRequestSorting($request, array $handler)
    {
        if (!empty($handler['query']['sort'])) {

            $orders = array();
            foreach ((array) $handler['query']['sort'] as $field => $params) {

                $params += array('VALUE', 'ASCENDING');

                list($type, $direction) = array_map('strtoupper', $params);

                $order = new \Google_Service_AnalyticsReporting_OrderBy;

                $order->setFieldName($field);
                $order->setOrderType($type);
                $order->setSortOrder($direction);

                $orders[] = $order;
            }

            $request->setOrderBys($orders);
        }
    }
protected function setRequestSorting ( $ request , array $ handler ) { if ( ! empty ( $ handler [ 'query' ] [ 'sort' ] ) ) { $ orders = array ( ) ; foreach ( ( array ) $ handler [ 'query' ] [ 'sort' ] as $ field => $ params ) { $ params += array ( 'VALUE' , 'ASCENDING' ) ; list ( $ type , $ direction ) = array_map ( 'strtoupper' , $ params ) ; $ order = new \ Google_Service_AnalyticsReporting_OrderBy ; $ order -> setFieldName ( $ field ) ; $ order -> setOrderType ( $ type ) ; $ order -> setSortOrder ( $ direction ) ; $ orders [ ] = $ order ; } $ request -> setOrderBys ( $ orders ) ; } }
Sets request sorting from a handler
@param \Google_Service_AnalyticsReporting_ReportRequest $request
@param array $handler
Sets request sorting from a handler