advanced callback structure
This commit is contained in:
@ -43,6 +43,7 @@ class LibXmlRpcCallbacks implements CallbackListener {
|
||||
*/
|
||||
public function handleScriptCallback($name, $data) {
|
||||
var_dump($name);
|
||||
//var_dump($data);
|
||||
switch ($name) {
|
||||
//New callbacks
|
||||
case 'XmlRpc.CallbacksList':
|
||||
|
@ -14,12 +14,38 @@ use ManiaControl\ManiaControl;
|
||||
abstract class BaseStructure {
|
||||
/** @var ManiaControl $maniaControl */
|
||||
protected $maniaControl;
|
||||
private $plainJson;
|
||||
|
||||
/**
|
||||
* Sets ManiaControl
|
||||
*
|
||||
* @param \ManiaControl\ManiaControl $maniaControl
|
||||
*/
|
||||
protected function setManiaControl(ManiaControl $maniaControl) {
|
||||
$this->maniaControl = $maniaControl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes the Data and Sets the Json
|
||||
*
|
||||
* @param array $data
|
||||
*/
|
||||
protected function setJson($data) {
|
||||
$this->plainJson = json_decode($data[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Plain Json
|
||||
*/
|
||||
public function getJson() {
|
||||
return $this->plainJson;
|
||||
}
|
||||
|
||||
/**
|
||||
* Var_Dump the Structure
|
||||
*/
|
||||
public function dump() {
|
||||
var_dump($this->getJson());
|
||||
var_dump(json_decode(json_encode($this)));
|
||||
}
|
||||
|
||||
}
|
@ -14,9 +14,9 @@ use ManiaControl\ManiaControl;
|
||||
*/
|
||||
class CallbacksListStructure extends BaseStructure {
|
||||
/** @var string $responseId */
|
||||
private $responseId;
|
||||
public $responseId;
|
||||
/** @var array $callbacks */
|
||||
private $callbacks;
|
||||
public $callbacks;
|
||||
|
||||
/**
|
||||
* Construct a new Armor Empty Structure
|
||||
@ -25,13 +25,13 @@ class CallbacksListStructure extends BaseStructure {
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(ManiaControl $maniaControl, $data) {
|
||||
$this->maniaControl = $maniaControl;
|
||||
parent::setManiaControl($maniaControl);
|
||||
parent::setJson($data);
|
||||
|
||||
//Not tested yet, TODO test
|
||||
$json = json_decode($data);
|
||||
$this->responseId = $this->getJson()->responseid;
|
||||
$this->callbacks = $this->getJson()->callbacks;
|
||||
|
||||
$this->responseId = $json->responseId;
|
||||
$this->callbacks = $json->callbacks;
|
||||
//$this->dump();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user