cvs: pear /Net_GameServerQuery/GameServerQuery Process.php
| From: | Aidan Lister | Date: | Tue, 18 Jan 2005 04:55:25 +0000 |
| Subject: | cvs: pear /Net_GameServerQuery/GameServerQuery Process.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-28648@lists.php.net to get a copy of this message | ||
aidan Mon Jan 17 23:55:25 2005 EDT
Modified files:
/pear/Net_GameServerQuery/GameServerQuery Process.php
Log:
Switched to GameData class
http://cvs.php.net/diff.php/pear/Net_GameServerQuery/GameServerQuery/Process.php?r1=1.23&r2=1.24&ty=u
Index: pear/Net_GameServerQuery/GameServerQuery/Process.php
diff -u pear/Net_GameServerQuery/GameServerQuery/Process.php:1.23
pear/Net_GameServerQuery/GameServerQuery/Process.php:1.24
--- pear/Net_GameServerQuery/GameServerQuery/Process.php:1.23 Fri Jan 14 14:01:11 2005
+++ pear/Net_GameServerQuery/GameServerQuery/Process.php Mon Jan 17 23:55:24 2005
@@ -16,20 +16,20 @@
// | Tom Buskens <ortega@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: Process.php,v 1.23 2005/01/14 19:01:11 aidan Exp $
+// $Id: Process.php,v 1.24 2005/01/18 04:55:24 aidan Exp $
/**
- * Processing class
+ * Process the server responses
*
- * This class wraps around the processing methods.
- * Calls the normalise and protocol classes for each game.
+ * Loads the protocol drivers to parse packets, and runs
+ * the normalistion methods
*
* @category Net
* @package Net_GameServerQuery
* @author Aidan Lister <aidan@php.net>
* @author Tom Buskens <ortega@php.net>
- * @version $Revision: 1.23 $
+ * @version $Revision: 1.24 $
*/
class Net_GameServerQuery_Process
{
@@ -39,7 +39,7 @@
*
* @var object
*/
- private $_config;
+ private $_gamedata;
/**
@@ -53,9 +53,9 @@
/**
* Constructor
*/
- public function __construct($config)
+ public function __construct($gamedata)
{
- $this->_config = $config;
+ $this->_gamedata = $gamedata;
$this->_protocols = array();
}
@@ -73,7 +73,7 @@
return new $classname;
}
- throw new Exception('Protocol driver not found');
+ throw new DriverNotFoundException;
}
/**
@@ -113,8 +113,9 @@
}
// Parse the response
- $protocol = $this->_protocols[$result['protocol']];
- $parsed = $protocol->parse($result['packetname'],
$result['response']);
+ $protocol =& $this->_protocols[$result['protocol']];
+ $response = $result['response'];
+ $parsed = $protocol->parse($result['packetname'], $response);
// Normalise the response
$result = $this->normalise($result['protocol'], $result['flag'],
$parsed);
@@ -138,10 +139,10 @@
return $data;
}
- $keys = $this->_config->normal();
- $normals = $this->_config->normal($protocol);
+ $keys = $this->_gamedata->getProtocolNormals();
+ $normals = $this->_gamedata->getProtocolNormals($protocol);
- // If no normal keys are set return
+ // If no normal keys are set return all
if (empty($normals)) {
return $data;
}