public static function parsePlayers(&$st)
    {
        $playersn = Binary::getByte($st);
        $players = [];
        for ($i = 1; $i < $playersn; ++$i) {
            $n = Binary::getByte($st);
            $name = Binary::getString($st);
            $score = Binary::getDWord($st, true);
            if (mb_orig_strlen($st) === 0) {
                break;
            }
            $u = unpack('f', mb_orig_substr($st, 0, 4));
            $st = mb_orig_substr($st, 4);
            $seconds = $u[1];
            if ($seconds === -1) {
                continue;
            }
            $players[] = [
                'name' => Encoding::toUTF8($name),
                'score' => $score,
                'seconds' => $seconds,
                'joinedts' => microtime(true) - $seconds,
                'spm' => $score / ($seconds / 60),
            ];
        }
        return $players;
    }
public static function parsePlayers(&$st)
    {
        $playersn = Binary::getByte($st);
        $players = [];
        for ($i = 1; $i < $playersn; ++$i) {
            $n = Binary::getByte($st);
            $name = Binary::getString($st);
            $score = Binary::getDWord($st, true);
            if (mb_orig_strlen($st) === 0) {
                break;
            }
            $u = unpack('f', mb_orig_substr($st, 0, 4));
            $st = mb_orig_substr($st, 4);
            $seconds = $u[1];
            if ($seconds === -1) {
                continue;
            }
            $players[] = [
                'name' => Encoding::toUTF8($name),
                'score' => $score,
                'seconds' => $seconds,
                'joinedts' => microtime(true) - $seconds,
                'spm' => $score / ($seconds / 60),
            ];
        }
        return $players;
    }
public static function parsePlayers ( & $ st ) { $ playersn = Binary :: getByte ( $ st ) ; $ players = [ ] ; for ( $ i = 1 ; $ i < $ playersn ; ++ $ i ) { $ n = Binary :: getByte ( $ st ) ; $ name = Binary :: getString ( $ st ) ; $ score = Binary :: getDWord ( $ st , true ) ; if ( mb_orig_strlen ( $ st ) === 0 ) { break ; } $ u = unpack ( 'f' , mb_orig_substr ( $ st , 0 , 4 ) ) ; $ st = mb_orig_substr ( $ st , 4 ) ; $ seconds = $ u [ 1 ] ; if ( $ seconds === - 1 ) { continue ; } $ players [ ] = [ 'name' => Encoding :: toUTF8 ( $ name ) , 'score' => $ score , 'seconds' => $ seconds , 'joinedts' => microtime ( true ) - $ seconds , 'spm' => $ score / ( $ seconds / 60 ) , ] ; } return $ players ; }
Parses response to 'players' command into structure
@param  string &$st Data
@return array       Structure
Parses response to players command into structure