[TASK] Introducing the ProtocolHandler

This commit is contained in:
Jan Philipp Timme
2010-11-28 00:04:35 +00:00
parent f3b1354aa2
commit bdd9f671ad
7 changed files with 84 additions and 4 deletions
+26 -2
View File
@@ -17,18 +17,43 @@ abstract class Client_AbstractClient {
*/
protected $group;
/**
* @var mixed Instance of Protocol_AbstractProtocolHandler
*/
protected $protocolHandler;
/**
* Contains a reference to the ClientManager in order to change stuff on the fly.
* @var Client_ClientManager
*/
protected $clientManager;
/**
* Injects ProtocolHandler
* @param unknown_type $protocolHandler
* @return void
*/
public function injectProtocolHandler($protocolHandler) {
$this->protocolHandler = $protocolHandler;
}
/**
* Forwards incoming data to the ProtocolParser.
* Calls protected processData()
* @param string $rawData
* @return void
*/
public function putRawData($rawData) {
$contentObject = $this->protocolHandler->parse($rawData);
$this->processContentObject($contentObject);
}
/**
* This function will be the main entry point of any client.
* @param string $data
* @return string
*/
abstract public function processData($data);
abstract protected function processContentObject($contentObject);
/**
* This function will load the given config.
@@ -50,7 +75,6 @@ abstract class Client_AbstractClient {
$this->group = $group;
}
/**
* Injects ClientManager
* @param Client_ClientManager $clientManager