cvs: pear /Net_GameServerQuery/GameServerQuery/Process Result.php
| From: | Aidan Lister | Date: | Tue, 18 Jan 2005 04:59:04 +0000 |
| Subject: | cvs: pear /Net_GameServerQuery/GameServerQuery/Process Result.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-28650@lists.php.net to get a copy of this message | ||
aidan Mon Jan 17 23:59:04 2005 EDT
Added files:
/pear/Net_GameServerQuery/GameServerQuery/Process Result.php
Log:
Moved old Result class
http://cvs.php.net/co.php/pear/Net_GameServerQuery/GameServerQuery/Process/Result.php?r=1.1&p=1
Index: pear/Net_GameServerQuery/GameServerQuery/Process/Result.php
+++ pear/Net_GameServerQuery/GameServerQuery/Process/Result.php
<?php
// +----------------------------------------------------------------------+
// | PHP version 4 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2004 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 3.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at the following url: |
// | http://www.php.net/license/3_0.txt.
|
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Aidan Lister <aidan@php.net> |
// | Tom Buskens <ortega@php.net> |
// +----------------------------------------------------------------------+
//
// $Id: Result.php,v 1.1 2005/01/18 04:59:04 aidan Exp $
/**
* Provide an interface for easy storage of a parsed server response
*
* @category Net
* @package Net_GameServerQuery
* @author Aidan Lister <aidan@php.net>
* @author Tom Buskens <ortega@php.net>
* @version $Revision: 1.1 $
*/
class Net_GameServerQuery_Process_Result
{
/**
* Formatted server response
*
* @var array
* @access public
*/
private $_result;
/**
* Highest player index
*
* @var int
* @access public
*/
private $_pindex = 0;
/**
* Adds variable to results
*
* @param string $name Variable name
* @param string $value Variable value
*/
public function add($name, $value)
{
$this->_result[$name] = $value;
}
/**
* Adds meta information to the results
*
* Currently prefixes key with __
*
* @param string $name Variable name
* @param string $value Variable value
*/
public function addMeta($name, $value)
{
$this->_result['__' . $name] = $value;
}
/**
* Adds player variable to output
*
* @param string $name Variable name
* @param string $value Variable value
*/
public function addPlayer($name, $value)
{
// Player var is already set, so it must belong to the next player
if (isset($this->_result[$this->_pindex][$name])) {
++$this->_pindex;
}
// Set player var
$this->_result[$this->_pindex][$name] = $value;
}
/**
* Return the results
*
* @return array The results
*/
public function fetch()
{
return $this->_result;
}
}
?>