diff options
-rw-r--r-- | inc/Remote/Api.php | 69 | ||||
-rw-r--r-- | inc/Remote/JsonRpcServer.php | 10 | ||||
-rw-r--r-- | inc/Remote/XmlRpcServer.php | 20 |
3 files changed, 2 insertions, 97 deletions
diff --git a/inc/Remote/Api.php b/inc/Remote/Api.php index d258d59b4..00e28a07f 100644 --- a/inc/Remote/Api.php +++ b/inc/Remote/Api.php @@ -4,6 +4,7 @@ namespace dokuwiki\Remote; use dokuwiki\Extension\RemotePlugin; use dokuwiki\Logger; +use dokuwiki\test\Remote\MockApiCore; /** * This class provides information about remote access to the wiki. @@ -42,18 +43,6 @@ class Api /** @var ApiCall[] remote methods provided by dokuwiki plugins */ protected $pluginMethods; - private $dateTransformation; - private $fileTransformation; - - /** - * constructor - */ - public function __construct() - { - $this->dateTransformation = [$this, 'dummyTransformation']; - $this->fileTransformation = [$this, 'dummyTransformation']; - } - /** * Get all available methods with remote access. * @@ -67,7 +56,7 @@ class Api /** * Collects all the core methods * - * @param ApiCore|\RemoteAPICoreTest $apiCore this parameter is used for testing. + * @param ApiCore|MockApiCore $apiCore this parameter is used for testing. * Here you can pass a non-default RemoteAPICore instance. (for mocking) * @return ApiCall[] all core methods. */ @@ -188,58 +177,4 @@ class Api // still here? no can do throw new AccessDeniedException('server error. not authorized to call method', -32604); } - - /** - * Transform file to xml - * - * @param mixed $data - * @return mixed - */ - public function toFile($data) - { - return call_user_func($this->fileTransformation, $data); - } - - /** - * Transform date to xml - * - * @param mixed $data - * @return mixed - */ - public function toDate($data) - { - return call_user_func($this->dateTransformation, $data); - } - - /** - * A simple transformation - * - * @param mixed $data - * @return mixed - */ - public function dummyTransformation($data) - { - return $data; - } - - /** - * Set the transformer function - * - * @param callback $dateTransformation - */ - public function setDateTransformation($dateTransformation) - { - $this->dateTransformation = $dateTransformation; - } - - /** - * Set the transformer function - * - * @param callback $fileTransformation - */ - public function setFileTransformation($fileTransformation) - { - $this->fileTransformation = $fileTransformation; - } - } diff --git a/inc/Remote/JsonRpcServer.php b/inc/Remote/JsonRpcServer.php index 0708eb96f..f92942771 100644 --- a/inc/Remote/JsonRpcServer.php +++ b/inc/Remote/JsonRpcServer.php @@ -18,7 +18,6 @@ class JsonRpcServer public function __construct() { $this->remote = new Api(); - $this->remote->setFileTransformation([$this, 'toFile']); } /** @@ -183,13 +182,4 @@ class JsonRpcServer throw $e; } } - - /** - * @param string $data - * @return string - */ - public function toFile($data) - { - return base64_encode($data); - } } diff --git a/inc/Remote/XmlRpcServer.php b/inc/Remote/XmlRpcServer.php index e41b5d791..9985fe760 100644 --- a/inc/Remote/XmlRpcServer.php +++ b/inc/Remote/XmlRpcServer.php @@ -20,8 +20,6 @@ class XmlRpcServer extends Server public function __construct($wait = false) { $this->remote = new Api(); - $this->remote->setDateTransformation([$this, 'toDate']); - $this->remote->setFileTransformation([$this, 'toFile']); parent::__construct(false, false, $wait); } @@ -68,22 +66,4 @@ class XmlRpcServer extends Server return new ServerException($e->getMessage(), $e->getCode()); } } - - /** - * @param string|int $data iso date(yyyy[-]mm[-]dd[ hh:mm[:ss]]) or timestamp - * @return Date - */ - public function toDate($data) - { - return new Date($data); - } - - /** - * @param string $data - * @return Base64 - */ - public function toFile($data) - { - return new Base64($data); - } } |