protected function _computeKey($key)
    {
        $spaces = 0;
        $digits = '';

        for ($i = 0, $s = mb_orig_strlen($key); $i < $s; ++$i) {
            $c = mb_orig_substr($key, $i, 1);

            if ($c === "\x20") {
                ++$spaces;
            } elseif (ctype_digit($c)) {
                $digits .= $c;
            }
        }

        if ($spaces > 0) {
            $result = (float)floor($digits / $spaces);
        } else {
            $result = (float)$digits;
        }

        return pack('N', $result);
    }
protected function _computeKey($key)
    {
        $spaces = 0;
        $digits = '';

        for ($i = 0, $s = mb_orig_strlen($key); $i < $s; ++$i) {
            $c = mb_orig_substr($key, $i, 1);

            if ($c === "\x20") {
                ++$spaces;
            } elseif (ctype_digit($c)) {
                $digits .= $c;
            }
        }

        if ($spaces > 0) {
            $result = (float)floor($digits / $spaces);
        } else {
            $result = (float)$digits;
        }

        return pack('N', $result);
    }
protected function _computeKey ( $ key ) { $ spaces = 0 ; $ digits = '' ; for ( $ i = 0 , $ s = mb_orig_strlen ( $ key ) ; $ i < $ s ; ++ $ i ) { $ c = mb_orig_substr ( $ key , $ i , 1 ) ; if ( $ c === "\x20" ) { ++ $ spaces ; } elseif ( ctype_digit ( $ c ) ) { $ digits .= $ c ; } } if ( $ spaces > 0 ) { $ result = ( float ) floor ( $ digits / $ spaces ) ; } else { $ result = ( float ) $ digits ; } return pack ( 'N' , $ result ) ; }
Computes key for Sec-WebSocket.
@param string Key
@return string Result
Computes key for Sec - WebSocket .