protected function processStatus(Buffer $buffer)
    {
        // Set the result to a new result instance
        $result = new Result();

        // By default dedicted
        $result->add('dedicated', 1);

        // Lets peek and see if the data starts with a \
        if ($buffer->lookAhead(1) == '\\') {
            // Burn the first one
            $buffer->skip(1);
        }

        // Explode the data
        $data = explode('\\', $buffer->getBuffer());

        // No longer needed
        unset($buffer);

        // Init some vars
        $numPlayers = 0;
        $numTeams = 0;

        $itemCount = count($data);

        // Now lets loop the array
        for ($x = 0; $x < $itemCount; $x += 2) {
            // Set some local vars
            $key = $data[$x];
            $val = $data[$x + 1];

            // Check for <variable>_<count> variable (i.e players)
            if (($suffix = strrpos($key, '_')) !== false && is_numeric(substr($key, $suffix + 1))) {
                // See if this is a team designation
                if (substr($key, 0, $suffix) == 'teamname') {
                    $result->addTeam('teamname', $val);
                    $numTeams++;
                } else {
                    // Its a player
                    if (substr($key, 0, $suffix) == 'playername') {
                        $numPlayers++;
                    }
                    $result->addPlayer(substr($key, 0, $suffix), utf8_encode($val));
                }
            } else {
                // Regular variable so just add the value.
                $result->add($key, $val);
            }
        }

        // Add the player and team count
        $result->add('num_players', $numPlayers);
        $result->add('num_teams', $numTeams);

        // Unset some stuff to free up memory
        unset($data, $key, $val, $suffix, $x, $itemCount);

        // Return the result
        return $result->fetch();
    }
protected function processStatus(Buffer $buffer)
    {
        // Set the result to a new result instance
        $result = new Result();

        // By default dedicted
        $result->add('dedicated', 1);

        // Lets peek and see if the data starts with a \
        if ($buffer->lookAhead(1) == '\\') {
            // Burn the first one
            $buffer->skip(1);
        }

        // Explode the data
        $data = explode('\\', $buffer->getBuffer());

        // No longer needed
        unset($buffer);

        // Init some vars
        $numPlayers = 0;
        $numTeams = 0;

        $itemCount = count($data);

        // Now lets loop the array
        for ($x = 0; $x < $itemCount; $x += 2) {
            // Set some local vars
            $key = $data[$x];
            $val = $data[$x + 1];

            // Check for <variable>_<count> variable (i.e players)
            if (($suffix = strrpos($key, '_')) !== false && is_numeric(substr($key, $suffix + 1))) {
                // See if this is a team designation
                if (substr($key, 0, $suffix) == 'teamname') {
                    $result->addTeam('teamname', $val);
                    $numTeams++;
                } else {
                    // Its a player
                    if (substr($key, 0, $suffix) == 'playername') {
                        $numPlayers++;
                    }
                    $result->addPlayer(substr($key, 0, $suffix), utf8_encode($val));
                }
            } else {
                // Regular variable so just add the value.
                $result->add($key, $val);
            }
        }

        // Add the player and team count
        $result->add('num_players', $numPlayers);
        $result->add('num_teams', $numTeams);

        // Unset some stuff to free up memory
        unset($data, $key, $val, $suffix, $x, $itemCount);

        // Return the result
        return $result->fetch();
    }
protected function processStatus ( Buffer $ buffer ) { // Set the result to a new result instance $ result = new Result ( ) ; // By default dedicted $ result -> add ( 'dedicated' , 1 ) ; // Lets peek and see if the data starts with a \ if ( $ buffer -> lookAhead ( 1 ) == '\\' ) { // Burn the first one $ buffer -> skip ( 1 ) ; } // Explode the data $ data = explode ( '\\' , $ buffer -> getBuffer ( ) ) ; // No longer needed unset ( $ buffer ) ; // Init some vars $ numPlayers = 0 ; $ numTeams = 0 ; $ itemCount = count ( $ data ) ; // Now lets loop the array for ( $ x = 0 ; $ x < $ itemCount ; $ x += 2 ) { // Set some local vars $ key = $ data [ $ x ] ; $ val = $ data [ $ x + 1 ] ; // Check for <variable>_<count> variable (i.e players) if ( ( $ suffix = strrpos ( $ key , '_' ) ) !== false && is_numeric ( substr ( $ key , $ suffix + 1 ) ) ) { // See if this is a team designation if ( substr ( $ key , 0 , $ suffix ) == 'teamname' ) { $ result -> addTeam ( 'teamname' , $ val ) ; $ numTeams ++ ; } else { // Its a player if ( substr ( $ key , 0 , $ suffix ) == 'playername' ) { $ numPlayers ++ ; } $ result -> addPlayer ( substr ( $ key , 0 , $ suffix ) , utf8_encode ( $ val ) ) ; } } else { // Regular variable so just add the value. $ result -> add ( $ key , $ val ) ; } } // Add the player and team count $ result -> add ( 'num_players' , $ numPlayers ) ; $ result -> add ( 'num_teams' , $ numTeams ) ; // Unset some stuff to free up memory unset ( $ data , $ key , $ val , $ suffix , $ x , $ itemCount ) ; // Return the result return $ result -> fetch ( ) ; }
Handle processing the status buffer

@param Buffer $buffer

@return array
Handle processing the status buffer