public function decodeContent()
    {
        $contentType = $this->headers->get('content-type', 'text/plain');

        if ($contentType === 'application/json' || $contentType === 'application/json; charset=UTF-8') {
            return json_decode($this->content, true);
        }

        if ($contentType === 'text/xml' || $contentType === 'text/xml; charset=UTF-8') {
            $xml = simplexml_load_string($this->content);
            $json = json_encode($xml);

            return json_decode($json, true);
        }

        return $this->content;
    }
public function decodeContent()
    {
        $contentType = $this->headers->get('content-type', 'text/plain');

        if ($contentType === 'application/json' || $contentType === 'application/json; charset=UTF-8') {
            return json_decode($this->content, true);
        }

        if ($contentType === 'text/xml' || $contentType === 'text/xml; charset=UTF-8') {
            $xml = simplexml_load_string($this->content);
            $json = json_encode($xml);

            return json_decode($json, true);
        }

        return $this->content;
    }
public function decodeContent ( ) { $ contentType = $ this -> headers -> get ( 'content-type' , 'text/plain' ) ; if ( $ contentType === 'application/json' || $ contentType === 'application/json; charset=UTF-8' ) { return json_decode ( $ this -> content , true ) ; } if ( $ contentType === 'text/xml' || $ contentType === 'text/xml; charset=UTF-8' ) { $ xml = simplexml_load_string ( $ this -> content ) ; $ json = json_encode ( $ xml ) ; return json_decode ( $ json , true ) ; } return $ this -> content ; }
Decode the content

@return array Content
Decode the content