cvs: pear /Net_GameServerQuery GameServerQuery.php
| From: | Aidan Lister | Date: | Tue, 18 Jan 2005 04:40:06 +0000 |
| Subject: | cvs: pear /Net_GameServerQuery GameServerQuery.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-28646@lists.php.net to get a copy of this message | ||
aidan Mon Jan 17 23:40:06 2005 EDT
Modified files:
/pear/Net_GameServerQuery GameServerQuery.php
Log:
Changed config class to GameData. Added exception for InvalidGame. Renamed GameData methods to
match the new class.
http://cvs.php.net/diff.php/pear/Net_GameServerQuery/GameServerQuery.php?r1=1.49&r2=1.50&ty=u
Index: pear/Net_GameServerQuery/GameServerQuery.php
diff -u pear/Net_GameServerQuery/GameServerQuery.php:1.49
pear/Net_GameServerQuery/GameServerQuery.php:1.50
--- pear/Net_GameServerQuery/GameServerQuery.php:1.49 Sat Jan 15 09:18:10 2005
+++ pear/Net_GameServerQuery/GameServerQuery.php Mon Jan 17 23:40:06 2005
@@ -16,12 +16,12 @@
// | Tom Buskens <ortega@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: GameServerQuery.php,v 1.49 2005/01/15 14:18:10 aidan Exp $
+// $Id: GameServerQuery.php,v 1.50 2005/01/18 04:40:06 aidan Exp $
define('NET_GAMESERVERQUERY_BASE', dirname(__FILE__) . '/GameServerQuery/');
-require_once NET_GAMESERVERQUERY_BASE . 'Config.php';
+require_once NET_GAMESERVERQUERY_BASE . 'GameData.php';
require_once NET_GAMESERVERQUERY_BASE . 'Communicate.php';
require_once NET_GAMESERVERQUERY_BASE . 'Process.php';
require_once NET_GAMESERVERQUERY_BASE . 'Error.php';
@@ -34,7 +34,7 @@
* @package Net_GameServerQuery
* @author Aidan Lister <aidan@php.net>
* @author Tom Buskens <ortega@php.net>
- * @version $Revision: 1.49 $
+ * @version $Revision: 1.50 $
*/
class Net_GameServerQuery
{
@@ -57,7 +57,7 @@
*
* @var object
*/
- private $_config;
+ private $_gamedata;
/**
* An instance of the Net_GameServerQuery_Communicate class
@@ -102,9 +102,9 @@
$this->_options = array('normalise' => true, 'showmeta' =>
true);
// Load classes
- $this->_config = new Net_GameServerQuery_Config;
+ $this->_gamedata = new Net_GameServerQuery_GameData;
$this->_communicate = new Net_GameServerQuery_Communicate;
- $this->_process = new Net_GameServerQuery_Process($this->_config);
+ $this->_process = new Net_GameServerQuery_Process($this->_gamedata);
}
@@ -160,8 +160,8 @@
public function addServer($game, $addr, $port = null, $query = 'status')
{
// Validate game
- if ($this->_config->validgame($game) === false) {
- throw new Exception ('Invalid Game');
+ if ($this->_gamedata->is_game($game) === false) {
+ throw new InvalidGameException;
return false;
}
@@ -169,11 +169,11 @@
// Find default port
if (is_null($port)) {
- $port = $this->_config->getPort($game);
+ $port = $this->_gamedata->getGamePort($game);
}
// Find the protocol
- $protocol = $this->_config->getProtocol($game);
+ $protocol = $this->_gamedata->getGameProtocol($game);
// Get list of queries to be sent
$queryflags = $this->_getQueryFlags($query);
@@ -273,7 +273,7 @@
++$this->_socketcount;
list($packetname, $packet) =
- $this->_config->getPacket($protocol, $flag);
+ $this->_gamedata->getProtocolPacket($protocol, $flag);
// Master list
$this->_socketlist[$this->_socketcount] = array(