HttpMessage/Request/Plugin/ParseRequestData.php
function parseBody()
    {
        $request = $this->getMessageObject();

        $reqID   = spl_object_hash($request);
        if ( isset(self::$_parsed[$reqID]) )
            // parse from cached
            return self::$_parsed[$reqID];

        if ($request->headers()->has('content-type')) {
            $contentType = \Poirot\Http\Header\renderHeaderValue($request, 'content-type');
            $contentType = strtolower($contentType);

        } else {
            // No Any Data Sent .....
            return array();
        }


        // Content-Type May be in form of:
        // application/x-www-form-urlencoded; charset=utf-8
        // when we call from jquery/ajax in exm.
        if ( false !== $pos = strpos($contentType, ';') )
            $contentType = substr($contentType, 0, $pos);


        switch ( $contentType )
        {
            case 'application/json':
                $parsedData = $this->_parseJsonDataFromRequest($request);
                break;

            case 'application/x-www-form-urlencoded':
                $parsedData = $this->_parseUrlEncodeDataFromRequest($request);
                break;
            case strpos($contentType, 'multipart') !== false:
                $parsedData = $this->_parseMultipartDataFromRequest($request);
                break;

            default:
                throw new \Exception(sprintf(
                    'Request Body Contains No Data or Unknown Content-Type (%s).'
                    , $contentType
                ));
        }


        return self::$_parsed[$reqID] = $parsedData;
    }
function parseBody()
    {
        $request = $this->getMessageObject();

        $reqID   = spl_object_hash($request);
        if ( isset(self::$_parsed[$reqID]) )
            // parse from cached
            return self::$_parsed[$reqID];

        if ($request->headers()->has('content-type')) {
            $contentType = \Poirot\Http\Header\renderHeaderValue($request, 'content-type');
            $contentType = strtolower($contentType);

        } else {
            // No Any Data Sent .....
            return array();
        }


        // Content-Type May be in form of:
        // application/x-www-form-urlencoded; charset=utf-8
        // when we call from jquery/ajax in exm.
        if ( false !== $pos = strpos($contentType, ';') )
            $contentType = substr($contentType, 0, $pos);


        switch ( $contentType )
        {
            case 'application/json':
                $parsedData = $this->_parseJsonDataFromRequest($request);
                break;

            case 'application/x-www-form-urlencoded':
                $parsedData = $this->_parseUrlEncodeDataFromRequest($request);
                break;
            case strpos($contentType, 'multipart') !== false:
                $parsedData = $this->_parseMultipartDataFromRequest($request);
                break;

            default:
                throw new \Exception(sprintf(
                    'Request Body Contains No Data or Unknown Content-Type (%s).'
                    , $contentType
                ));
        }


        return self::$_parsed[$reqID] = $parsedData;
    }
function parseBody ( ) { $ request = $ this -> getMessageObject ( ) ; $ reqID = spl_object_hash ( $ request ) ; if ( isset ( self :: $ _parsed [ $ reqID ] ) ) // parse from cached return self :: $ _parsed [ $ reqID ] ; if ( $ request -> headers ( ) -> has ( 'content-type' ) ) { $ contentType = \ Poirot \ Http \ Header \ renderHeaderValue ( $ request , 'content-type' ) ; $ contentType = strtolower ( $ contentType ) ; } else { // No Any Data Sent ..... return array ( ) ; } // Content-Type May be in form of: // application/x-www-form-urlencoded; charset=utf-8 // when we call from jquery/ajax in exm. if ( false !== $ pos = strpos ( $ contentType , ';' ) ) $ contentType = substr ( $ contentType , 0 , $ pos ) ; switch ( $ contentType ) { case 'application/json' : $ parsedData = $ this -> _parseJsonDataFromRequest ( $ request ) ; break ; case 'application/x-www-form-urlencoded' : $ parsedData = $ this -> _parseUrlEncodeDataFromRequest ( $ request ) ; break ; case strpos ( $ contentType , 'multipart' ) !== false : $ parsedData = $ this -> _parseMultipartDataFromRequest ( $ request ) ; break ; default : throw new \ Exception ( sprintf ( 'Request Body Contains No Data or Unknown Content-Type (%s).' , $ contentType ) ) ; } return self :: $ _parsed [ $ reqID ] = $ parsedData ; }
Parse Request Body Data

@return array
@throws \Exception
Parse Request Body Data