protected function fetchParams()
	{
	    $contentType = $this->getRequest()->getHeaders()->get('Content-Type');
	    if ($contentType) {
            $contentTypeParts = explode(';', $contentType->getFieldValue());
            $contentType = strtolower(trim($contentTypeParts[0]));
        }

	    if ($contentType === 'application/json') {
	        $json = $this->getRequest()->getContent();
	        $params = JsonDecoder::decode($json, JSON::TYPE_ARRAY);
	    } else {
	        // Parse parameters
	        if ($this->getRequest()->isPost()) {
	            $params = $this->getRequest()
	            ->getPost()
	            ->toArray();
	             
	            $params = array_merge(
	                    $params,
	                    $this->getRequest()
	                    ->getFiles()
	                    ->toArray()
	            );
	        } else {
	            $params = $this->getRequest()
	            ->getQuery()
	            ->toArray();
	        }
	    }
	    
	    // Use special 'q' parameters instead, if specified
	    if (isset($params['q'])) {
	        $params = Json::decode($params['q'], Json::TYPE_ARRAY);
	    
	        // Files are an exception, as they cannot be passed as part of
	        // the special q parameter
	        foreach ($this->getRequest()->getFiles() as $name => $value) {
	            if (!isset($params[$name])) {
	                $params[$name] = $value;
	            }
	        }
	    } else {
	        // Use route param 'path' and parse its parameters
	        $paramsInRoute = $this->getRouteParam('path');
	        
	        if ($paramsInRoute && $paramsInRoute !== '/') {
	            $paramsInRoute = explode('/', $paramsInRoute);
	            array_shift($paramsInRoute);
	             
	            $params = array_merge(
	                    $params,
	                    $paramsInRoute);
	        }
	    }
	    
	    return $params;
	}
protected function fetchParams()
	{
	    $contentType = $this->getRequest()->getHeaders()->get('Content-Type');
	    if ($contentType) {
            $contentTypeParts = explode(';', $contentType->getFieldValue());
            $contentType = strtolower(trim($contentTypeParts[0]));
        }

	    if ($contentType === 'application/json') {
	        $json = $this->getRequest()->getContent();
	        $params = JsonDecoder::decode($json, JSON::TYPE_ARRAY);
	    } else {
	        // Parse parameters
	        if ($this->getRequest()->isPost()) {
	            $params = $this->getRequest()
	            ->getPost()
	            ->toArray();
	             
	            $params = array_merge(
	                    $params,
	                    $this->getRequest()
	                    ->getFiles()
	                    ->toArray()
	            );
	        } else {
	            $params = $this->getRequest()
	            ->getQuery()
	            ->toArray();
	        }
	    }
	    
	    // Use special 'q' parameters instead, if specified
	    if (isset($params['q'])) {
	        $params = Json::decode($params['q'], Json::TYPE_ARRAY);
	    
	        // Files are an exception, as they cannot be passed as part of
	        // the special q parameter
	        foreach ($this->getRequest()->getFiles() as $name => $value) {
	            if (!isset($params[$name])) {
	                $params[$name] = $value;
	            }
	        }
	    } else {
	        // Use route param 'path' and parse its parameters
	        $paramsInRoute = $this->getRouteParam('path');
	        
	        if ($paramsInRoute && $paramsInRoute !== '/') {
	            $paramsInRoute = explode('/', $paramsInRoute);
	            array_shift($paramsInRoute);
	             
	            $params = array_merge(
	                    $params,
	                    $paramsInRoute);
	        }
	    }
	    
	    return $params;
	}
protected function fetchParams ( ) { $ contentType = $ this -> getRequest ( ) -> getHeaders ( ) -> get ( 'Content-Type' ) ; if ( $ contentType ) { $ contentTypeParts = explode ( ';' , $ contentType -> getFieldValue ( ) ) ; $ contentType = strtolower ( trim ( $ contentTypeParts [ 0 ] ) ) ; } if ( $ contentType === 'application/json' ) { $ json = $ this -> getRequest ( ) -> getContent ( ) ; $ params = JsonDecoder :: decode ( $ json , JSON :: TYPE_ARRAY ) ; } else { // Parse parameters if ( $ this -> getRequest ( ) -> isPost ( ) ) { $ params = $ this -> getRequest ( ) -> getPost ( ) -> toArray ( ) ; $ params = array_merge ( $ params , $ this -> getRequest ( ) -> getFiles ( ) -> toArray ( ) ) ; } else { $ params = $ this -> getRequest ( ) -> getQuery ( ) -> toArray ( ) ; } } // Use special 'q' parameters instead, if specified if ( isset ( $ params [ 'q' ] ) ) { $ params = Json :: decode ( $ params [ 'q' ] , Json :: TYPE_ARRAY ) ; // Files are an exception, as they cannot be passed as part of // the special q parameter foreach ( $ this -> getRequest ( ) -> getFiles ( ) as $ name => $ value ) { if ( ! isset ( $ params [ $ name ] ) ) { $ params [ $ name ] = $ value ; } } } else { // Use route param 'path' and parse its parameters $ paramsInRoute = $ this -> getRouteParam ( 'path' ) ; if ( $ paramsInRoute && $ paramsInRoute !== '/' ) { $ paramsInRoute = explode ( '/' , $ paramsInRoute ) ; array_shift ( $ paramsInRoute ) ; $ params = array_merge ( $ params , $ paramsInRoute ) ; } } return $ params ; }
Parse parameters from request

@return array
Parse parameters from request