Jetpack_Client::_stringify_data PHP 메소드

_stringify_data() 공개 정적인 메소드

Takes an array or similar structure and recursively turns all values into strings. This is used to make sure that body hashes are made ith the string version, which is what will be seen after a server pulls up the data in the $_POST array.
public static _stringify_data ( array | mixed $data ) : array | string
$data array | mixed
리턴 array | string
    public static function _stringify_data($data)
    {
        // Booleans are special, lets just makes them and explicit 1/0 instead of the 0 being an empty string.
        if (is_bool($data)) {
            return $data ? "1" : "0";
        }
        // Cast objects into arrays.
        if (is_object($data)) {
            $data = (array) $data;
        }
        // Non arrays at this point should be just converted to strings.
        if (!is_array($data)) {
            return (string) $data;
        }
        foreach ($data as $key => &$value) {
            $value = self::_stringify_data($value);
        }
        return $data;
    }