public function serializeString(string $str = null)
    {
        if (null === $str) {
            $uint8 = $this->serializeInt(null);
        }
        else {
            // prepend size on 4 bytes
            $count = strlen($str);
            $uint8 = $this->serializeInt($count);

            // UTF-8 to binary
            for ($i = 0; $i < $count; $i++) {
                $dec = Ed25519::chrToInt(substr($str, $i, 1));
                array_push($uint8, $dec);
            }
        }

        return $uint8;
    }
public function serializeString(string $str = null)
    {
        if (null === $str) {
            $uint8 = $this->serializeInt(null);
        }
        else {
            // prepend size on 4 bytes
            $count = strlen($str);
            $uint8 = $this->serializeInt($count);

            // UTF-8 to binary
            for ($i = 0; $i < $count; $i++) {
                $dec = Ed25519::chrToInt(substr($str, $i, 1));
                array_push($uint8, $dec);
            }
        }

        return $uint8;
    }
public function serializeString ( string $ str = null ) { if ( null === $ str ) { $ uint8 = $ this -> serializeInt ( null ) ; } else { // prepend size on 4 bytes $ count = strlen ( $ str ) ; $ uint8 = $ this -> serializeInt ( $ count ) ; // UTF-8 to binary for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { $ dec = Ed25519 :: chrToInt ( substr ( $ str , $ i , 1 ) ) ; array_push ( $ uint8 , $ dec ) ; } } return $ uint8 ; }
Serialize string data. The serialized string will be prefixed
with a 4-bytes long Size field followed by the UInt8 representation
of the given `str`.

Takes in a string and returns an array of Unsigned Integers
on 8-bits.

@internal This method is used internally
@param   string  $str
@return  array       Returns a byte-array with values in UInt8 representation.
Serialize string data . The serialized string will be prefixed with a 4 - bytes long Size field followed by the UInt8 representation of the given str .