Decode the content

@return array Content
189429
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;
    }
908085
def decode(self, content, apple_fix=False):
        
        content = content.decode(self.encoding)
        content = content.replace('\r', '')

        if apple_fix:
            content = apple_data_fix(content)

        return content
447455
protected function contentToString()
    {
        $string = '';
        if (!is_null($this->content)) {
            foreach ($this->content as $c) {
                $string .= $c->toString();
            }
        }

        return $string;
    }
862254
protected function _decodeArray()
    {
        $result = array();
        $tok = $this->_getNextToken(); // Move past the '['
        $index  = 0;

        while ($tok && $tok != self::RBRACKET) {
            $result[$index++] = $this->_decodeValue();

            $tok = $this->token;

            if ($tok == self::RBRACKET || !$tok) {
                break;
            }

            if ($tok != self::COMMA) {
                throw new RuntimeException('Missing "," in array encoding: ' . $this->source);
            }

            $tok = $this->_getNextToken();
        }

        $this->_getNextToken();
        return $result;
    }
1133930
public function decodeUint32()
    {
        $value = $this->decodeBytes(4);
        if ($value === null) {
            return null;
        }
        $res = unpack('N', $value);
        return array_pop($res);
    }
572160
public function getContent(): string
    {
        $raw = '';
        foreach ($this->chunk(8192) as $chunk) {
            $raw .= $chunk;
        }

        return $raw;
    }
217994
public function getContent()
    {
        $content = $this->getRawContent();
        $content = apply_filters('the_content', $content);
        $content = str_replace( ']]>', ']]&gt;', $content);

        return $content;
    }
37797
protected function _getContentTransferEncoding()
    {
        if ($this->transferEncoding) {
            return $this->transferEncoding;
        }

        $charset = strtoupper($this->charset);
        if (in_array($charset, $this->_charset8bit)) {
            return '8bit';
        }

        return '7bit';
    }
1345701
public function content() {
		$keys = [];
		$values = [];

		if ($this->isGet()) {
			foreach ($_GET as $key => $value) {
				array_push( $keys, $key );
				array_push( $values, $value );
			}

			$data = array_combine( $keys, $values );
			$this->setData( $data );
		}

		return $this;
	}
1187603
protected function encodeContents()
    {
        $payload = [
            'version' => [
                'name'      => $this->version,
                'protocol'  => $this->protocol
            ],
            'players' => [
                'max'       => $this->max_players,
                'online'    => $this->online_count,
                'sample'    => $this->online_players
            ],
            'description'   => [
                'text'  => $this->description
            ],
        ];
        if($this->favicon !== null) {
            $payload['favicon'] = $this->favicon;
        }

        $jsonString = utf8_encode(json_encode($payload));

        return StringType::write($jsonString)->getEncoded();
    }
1164609
public function getContent() : ?array
     {
        $rtn = $this->data['content'];

        $rtn = json_decode($rtn, true);

        if ($rtn === false) {
            $rtn = null;
        }

        return $rtn;
     }
940823
public function decodeString()
    {
        $len = $this->decodeUint32();
        if ($len === null) {
            return null;
        }
        $value = $this->decodeBytes($len);
        if ($value === null) {
            $this->buffer->unget(pack('N', $len));
            return null;
        }
        return $value;
    }
69384
protected function encodeContents()
    {
        $serverIDEncoded = StringType::write($this->serverID);

        $encodedPublicKey = base64_decode($this->getPublicKey());
        $publicKeyLength = VarInt::writeUnsignedVarInt(strlen($encodedPublicKey));

        $encodedToken = $this->getToken();
        $tokenLength = VarInt::writeUnsignedVarInt(strlen($encodedToken));

        return $serverIDEncoded->getEncoded() . $publicKeyLength->getEncoded() . $encodedPublicKey . $tokenLength->getEncoded() . $encodedToken;
    }
158103
public function encode()
    {
        $reserved = [
            '!%21!ui' => "!",
            '!%23!ui' => "#",
            '!%24!ui' => "$",
            '!%26!ui' => "&",
            '!%27!ui' => "'",
            '!%28!ui' => "(",
            '!%29!ui' => ")",
            '!%2A!ui' => "*",
            '!%2B!ui' => "+",
            '!%2C!ui' => ",",
            '!%2F!ui' => "/",
            '!%3A!ui' => ":",
            '!%3B!ui' => ";",
            '!%3D!ui' => "=",
            '!%3F!ui' => "?",
            '!%40!ui' => "@",
            '!%5B!ui' => "[",
            '!%5D!ui' => "]",
            '!%25!ui' => "%",
        ];
        // The % character must be the last in the $reserved array.
        // This makes sure that the already encoded values are not lost or encoded again.
        $this->uri = preg_replace(array_keys($reserved), array_values($reserved), rawurlencode($this->uri));
        return $this->baseToLowercase();
    }
1324329
public function decode(string $data, string $contentType): array
    {
        return $this->decoder->decode($data, $contentType);
    }
829731
public function getContents()
    {
        if ($this->contents) {
            if ($this->contents[0]->getType() !== 'text/plain'
            && count($this->contents) > 1
            ) {
                foreach ($this->contents as $key => $value) {
                    if ($value->getType() == 'text/plain') {
                        $plain_content = $value;
                        unset($this->contents[$key]);
                        break;
                    }
                }
                array_unshift($this->contents, $plain_content);
            }
        }

        return $this->contents;
    }
1261920
public function getContent()
    {
        if ($this->content === null) {
            fseek($this->stream, 0);
            while (($buf = $this->read()) !== false) {
                $this->content .= $buf;
            }
        }

        return $this->content;
    }