protected static function prepareInputBuffer($data)
    {
        if ($data instanceof Buffer) {
            return $data;
        }
        elseif (is_string($data) && ctype_xdigit($data)) {
            return Buffer::fromHex($data);
        }
        elseif (is_string($data)) {
            return new Buffer($data);
        }
        elseif (is_array($data)) {
            // Uint8 provided (serialized data)
            return Buffer::fromUInt8($data);
        }

        return new Buffer((string) $data);
    }
protected static function prepareInputBuffer($data)
    {
        if ($data instanceof Buffer) {
            return $data;
        }
        elseif (is_string($data) && ctype_xdigit($data)) {
            return Buffer::fromHex($data);
        }
        elseif (is_string($data)) {
            return new Buffer($data);
        }
        elseif (is_array($data)) {
            // Uint8 provided (serialized data)
            return Buffer::fromUInt8($data);
        }

        return new Buffer((string) $data);
    }
protected static function prepareInputBuffer ( $ data ) { if ( $ data instanceof Buffer ) { return $ data ; } elseif ( is_string ( $ data ) && ctype_xdigit ( $ data ) ) { return Buffer :: fromHex ( $ data ) ; } elseif ( is_string ( $ data ) ) { return new Buffer ( $ data ) ; } elseif ( is_array ( $ data ) ) { // Uint8 provided (serialized data) return Buffer :: fromUInt8 ( $ data ) ; } return new Buffer ( ( string ) $ data ) ; }
Helper to prepare a `data` attribute into a \NEM\Core\Buffer
object for easier internal data representations.

@param   null|string|\NEM\Core\Buffer    $data   The data that needs to be added to the returned Buffer.
@return  \NEM\Core\Buffer
Helper to prepare a data attribute into a \ NEM \ Core \ Buffer object for easier internal data representations .