library/Garp/Content/Api/Rest.php
protected function _extractOptionsForFetch(array $params) {
        if (!isset($params['options'])) {
            $params['options'] = array();
        }
        try {
            $options = is_string($params['options']) ?
                Zend_Json::decode(urldecode($params['options'])) :
                $params['options'];
        } catch (Zend_Json_Exception $e) {
            throw new Garp_Content_Api_Rest_Exception(
                sprintf(self::EXCEPTION_INVALID_JSON, $e->getMessage())
            );
        }

        $options = array_get_subset(
            $options,
            array(
                'sort', 'start', 'limit', 'fields', 'query', 'group', 'with'
            )
        );
        if (!isset($options['limit'])) {
            $options['limit'] = self::DEFAULT_PAGE_LIMIT;
        }
        if (isset($options['with'])) {
            // Normalize into an array
            $options['with'] = (array)$options['with'];
        }
        if (array_get($params, 'id')) {
            $options['query']['id'] = $params['id'];
        }
        return $options;
    }
protected function _extractOptionsForFetch(array $params) {
        if (!isset($params['options'])) {
            $params['options'] = array();
        }
        try {
            $options = is_string($params['options']) ?
                Zend_Json::decode(urldecode($params['options'])) :
                $params['options'];
        } catch (Zend_Json_Exception $e) {
            throw new Garp_Content_Api_Rest_Exception(
                sprintf(self::EXCEPTION_INVALID_JSON, $e->getMessage())
            );
        }

        $options = array_get_subset(
            $options,
            array(
                'sort', 'start', 'limit', 'fields', 'query', 'group', 'with'
            )
        );
        if (!isset($options['limit'])) {
            $options['limit'] = self::DEFAULT_PAGE_LIMIT;
        }
        if (isset($options['with'])) {
            // Normalize into an array
            $options['with'] = (array)$options['with'];
        }
        if (array_get($params, 'id')) {
            $options['query']['id'] = $params['id'];
        }
        return $options;
    }
protected function _extractOptionsForFetch ( array $ params ) { if ( ! isset ( $ params [ 'options' ] ) ) { $ params [ 'options' ] = array ( ) ; } try { $ options = is_string ( $ params [ 'options' ] ) ? Zend_Json :: decode ( urldecode ( $ params [ 'options' ] ) ) : $ params [ 'options' ] ; } catch ( Zend_Json_Exception $ e ) { throw new Garp_Content_Api_Rest_Exception ( sprintf ( self :: EXCEPTION_INVALID_JSON , $ e -> getMessage ( ) ) ) ; } $ options = array_get_subset ( $ options , array ( 'sort' , 'start' , 'limit' , 'fields' , 'query' , 'group' , 'with' ) ) ; if ( ! isset ( $ options [ 'limit' ] ) ) { $ options [ 'limit' ] = self :: DEFAULT_PAGE_LIMIT ; } if ( isset ( $ options [ 'with' ] ) ) { // Normalize into an array $ options [ 'with' ] = ( array ) $ options [ 'with' ] ; } if ( array_get ( $ params , 'id' ) ) { $ options [ 'query' ] [ 'id' ] = $ params [ 'id' ] ; } return $ options ; }
Remove cruft from HTTP params and provide sensible defaults.

@param array $params The combined URL parameters
@return array
Remove cruft from HTTP params and provide sensible defaults .