added xmlrpc structures + removed/refactored double trigger code

This commit is contained in:
kremsy
2017-04-07 23:03:56 +02:00
parent 31054d7502
commit 782d8b50e8
12 changed files with 335 additions and 114 deletions

View File

@ -0,0 +1,54 @@
<?php
namespace ManiaControl\Callbacks\Structures\XmlRpc;
use ManiaControl\Callbacks\Structures\Common\BaseResponseStructure;
use ManiaControl\ManiaControl;
/**
* Structure Class for the AllApiVersions Structure Callback
*
* @api
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class AllApiVersionsStructure extends BaseResponseStructure {
private $latest;
private $versions;
/**
* Construct a new Callbacks Version Structure
*
* @param ManiaControl $maniaControl
* @param array $data
*/
public function __construct(ManiaControl $maniaControl, $data) {
parent::__construct($maniaControl, $data);
$this->latest = $this->getPlainJsonObject()->latest;
$this->versions = $this->getPlainJsonObject()->versions;
}
/**
* Get the Latest Version
*
* @api
* @return string
*/
public function getLatest() {
return $this->latest;
}
/**
* Get all Versions
*
* @api
* @return array
*/
public function getVersions() {
return $this->versions;
}
}

View File

@ -0,0 +1,41 @@
<?php
namespace ManiaControl\Callbacks\Structures\XmlRpc;
use ManiaControl\Callbacks\Structures\Common\BaseResponseStructure;
use ManiaControl\ManiaControl;
/**
* Structure Class for the ApiVersion Structure Callback
*
* @api
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class ApiVersionStructure extends BaseResponseStructure {
private $version;
/**
* Construct a new Callbacks Version Structure
*
* @param ManiaControl $maniaControl
* @param array $data
*/
public function __construct(ManiaControl $maniaControl, $data) {
parent::__construct($maniaControl, $data);
$this->version = $this->getPlainJsonObject()->version;
}
/**
* Gets the API Version
*
* @api
* @return string version
*/
public function getVersion() {
return $this->version;
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace ManiaControl\Callbacks\Structures\XmlRpc;
use ManiaControl\ManiaControl;
/**
* Structure Class for the CallbackHelp Structure Callback
*
* @api
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class CallbackHelpStructure extends DocumentationStructure {
private $callbackName;
/**
* Construct a new Callbacks List Structure
*
* @param ManiaControl $maniaControl
* @param array $data
*/
public function __construct(ManiaControl $maniaControl, $data) {
parent::__construct($maniaControl, $data);
$this->callbackName = $this->getPlainJsonObject()->callback;
}
/**
* Gets the Name of the Method
*
* @api
* @return mixed
*/
public function getMethodName() {
return $this->callbackName;
}
}

View File

@ -3,17 +3,17 @@
namespace ManiaControl\Callbacks\Structures\XmlRpc;
use ManiaControl\Callbacks\Structures\Common\BaseResponseStructure;
use ManiaControl\Callbacks\Structures\Common\BaseStructure;
use ManiaControl\ManiaControl;
/**
* Structure Class for the List Structure Callback
*
* @api
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class ListStructure extends BaseResponseStructure {
class CallbackListStructure extends BaseResponseStructure {
/** @var array $callbacks */
private $callbacks;
@ -26,13 +26,14 @@ class ListStructure extends BaseResponseStructure {
public function __construct(ManiaControl $maniaControl, $data) {
parent::__construct($maniaControl, $data);
$this->callbacks = $this->getPlainJsonObject()->callbacks;
$this->callbacks = $this->getPlainJsonObject()->callbacks;
}
/**
* Get Array of the Callbacks
*
* @api
* @return string[]
*/
public function getCallbacks() {

View File

@ -0,0 +1,42 @@
<?php
namespace ManiaControl\Callbacks\Structures\XmlRpc;
use ManiaControl\Callbacks\Structures\Common\BaseResponseStructure;
use ManiaControl\ManiaControl;
/**
* Structure Class for the Documentation Structure Callback
*
* @api
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class DocumentationStructure extends BaseResponseStructure {
private $documentation;
/**
* Construct a new Callbacks List Structure
*
* @param ManiaControl $maniaControl
* @param array $data
*/
public function __construct(ManiaControl $maniaControl, $data) {
parent::__construct($maniaControl, $data);
$this->documentation = $data[1];
}
/**
* Gets the Documentation
*
* @api
* @return string
*/
public function getDocumentation() {
return $this->documentation;
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace ManiaControl\Callbacks\Structures\XmlRpc;
use ManiaControl\ManiaControl;
/**
* Structure Class for the Method Help Structure Callback
*
* @api
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class MethodHelpStructure extends DocumentationStructure {
private $methodName;
/**
* Construct a new Callbacks List Structure
*
* @param ManiaControl $maniaControl
* @param array $data
*/
public function __construct(ManiaControl $maniaControl, $data) {
parent::__construct($maniaControl, $data);
$this->methodName = $this->getPlainJsonObject()->method;
}
/**
* Gets the Name of the Method
*
* @api
* @return mixed
*/
public function getMethodName() {
return $this->methodName;
}
}

View File

@ -0,0 +1,43 @@
<?php
namespace ManiaControl\Callbacks\Structures\XmlRpc;
use ManiaControl\Callbacks\Structures\Common\BaseResponseStructure;
use ManiaControl\ManiaControl;
/**
* Structure Class for the MethodList Structure Callback
*
* @api
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class MethodListStructure extends BaseResponseStructure {
/** @var array $callbacks */
private $methods;
/**
* Construct a new Callbacks List Structure
*
* @param ManiaControl $maniaControl
* @param array $data
*/
public function __construct(ManiaControl $maniaControl, $data) {
parent::__construct($maniaControl, $data);
$this->methods = $this->getPlainJsonObject()->methods;
}
/**
* Get Array of the Methods
*
* @api
* @return string[]
*/
public function getMethods() {
return $this->methods;
}
}