public function getData(NodeInterface $node = null, array $arguments)
    {
        if (!isset($arguments['stat'])) {
            throw new \InvalidArgumentException('Missing "stat" argument', 1416864525);
        }

        $startDateArgument = isset($arguments['startDate']) ? $arguments['startDate'] : '3 months ago';
        $endDateArgument = isset($arguments['endDate']) ? $arguments['endDate'] : '1 day ago';
        try {
            $startDate = new \DateTime($startDateArgument);
        } catch (\Exception $exception) {
            return ['error' => ['message' => 'Invalid date format for argument "startDate"', 'code' => 1417435564]];
        }
        try {
            $endDate = new \DateTime($endDateArgument);
        } catch (\Exception $exception) {
            return ['error' => ['message' => 'Invalid date format for argument "endDate"', 'code' => 1417435581]];
        }
        try {
            $stats = $this->reporting->getNodeStat($node, $this->controllerContext, $arguments['stat'], $startDate, $endDate);
            $data = [
                'data' => $stats
            ];

            return $data;
        } catch (\Google_Service_Exception $exception) {
            $errors = $exception->getErrors();

            return [
                'error' => [
                    'message' => isset($errors[0]['message']) ? $errors[0]['message'] : 'Google API returned error',
                    'code' => isset($errors[0]['reason']) ? $errors[0]['reason'] : 1417606128
                ]
            ];
        } catch (Exception $exception) {
            return [
                'error' => [
                    'message' => $exception->getMessage(),
                    'code' => $exception->getCode()
                ]
            ];
        }
    }
public function getData(NodeInterface $node = null, array $arguments)
    {
        if (!isset($arguments['stat'])) {
            throw new \InvalidArgumentException('Missing "stat" argument', 1416864525);
        }

        $startDateArgument = isset($arguments['startDate']) ? $arguments['startDate'] : '3 months ago';
        $endDateArgument = isset($arguments['endDate']) ? $arguments['endDate'] : '1 day ago';
        try {
            $startDate = new \DateTime($startDateArgument);
        } catch (\Exception $exception) {
            return ['error' => ['message' => 'Invalid date format for argument "startDate"', 'code' => 1417435564]];
        }
        try {
            $endDate = new \DateTime($endDateArgument);
        } catch (\Exception $exception) {
            return ['error' => ['message' => 'Invalid date format for argument "endDate"', 'code' => 1417435581]];
        }
        try {
            $stats = $this->reporting->getNodeStat($node, $this->controllerContext, $arguments['stat'], $startDate, $endDate);
            $data = [
                'data' => $stats
            ];

            return $data;
        } catch (\Google_Service_Exception $exception) {
            $errors = $exception->getErrors();

            return [
                'error' => [
                    'message' => isset($errors[0]['message']) ? $errors[0]['message'] : 'Google API returned error',
                    'code' => isset($errors[0]['reason']) ? $errors[0]['reason'] : 1417606128
                ]
            ];
        } catch (Exception $exception) {
            return [
                'error' => [
                    'message' => $exception->getMessage(),
                    'code' => $exception->getCode()
                ]
            ];
        }
    }
public function getData ( NodeInterface $ node = null , array $ arguments ) { if ( ! isset ( $ arguments [ 'stat' ] ) ) { throw new \ InvalidArgumentException ( 'Missing "stat" argument' , 1416864525 ) ; } $ startDateArgument = isset ( $ arguments [ 'startDate' ] ) ? $ arguments [ 'startDate' ] : '3 months ago' ; $ endDateArgument = isset ( $ arguments [ 'endDate' ] ) ? $ arguments [ 'endDate' ] : '1 day ago' ; try { $ startDate = new \ DateTime ( $ startDateArgument ) ; } catch ( \ Exception $ exception ) { return [ 'error' => [ 'message' => 'Invalid date format for argument "startDate"' , 'code' => 1417435564 ] ] ; } try { $ endDate = new \ DateTime ( $ endDateArgument ) ; } catch ( \ Exception $ exception ) { return [ 'error' => [ 'message' => 'Invalid date format for argument "endDate"' , 'code' => 1417435581 ] ] ; } try { $ stats = $ this -> reporting -> getNodeStat ( $ node , $ this -> controllerContext , $ arguments [ 'stat' ] , $ startDate , $ endDate ) ; $ data = [ 'data' => $ stats ] ; return $ data ; } catch ( \ Google_Service_Exception $ exception ) { $ errors = $ exception -> getErrors ( ) ; return [ 'error' => [ 'message' => isset ( $ errors [ 0 ] [ 'message' ] ) ? $ errors [ 0 ] [ 'message' ] : 'Google API returned error' , 'code' => isset ( $ errors [ 0 ] [ 'reason' ] ) ? $ errors [ 0 ] [ 'reason' ] : 1417606128 ] ] ; } catch ( Exception $ exception ) { return [ 'error' => [ 'message' => $ exception -> getMessage ( ) , 'code' => $ exception -> getCode ( ) ] ] ; } }
Get analytics stats for the given node

{@inheritdoc}
Get analytics stats for the given node