Updated DedicatedServer lib with latest changes by NewBoo.

This commit is contained in:
Max Klaversma 2014-04-19 01:59:49 +02:00 committed by Steffen Schröder
parent 85bc053fb3
commit c7abd69caa
3 changed files with 33 additions and 17 deletions

View File

@ -0,0 +1,26 @@
<?php
/**
* ManiaPlanet dedicated server Xml-RPC client
*
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
namespace Maniaplanet\DedicatedServer\Xmlrpc;
class FaultException extends Exception
{
static function create($faultString, $faultCode)
{
switch($faultString)
{
case 'Login unknown.':
return new LoginUnknownException($faultString, $faultCode);
}
return new self($faultString, $faultCode);
}
}
class LoginUnknownException extends FaultException {}
?>

View File

@ -302,20 +302,4 @@ class MessageException extends Exception
const RESPONSE_TOO_LARGE = 2; const RESPONSE_TOO_LARGE = 2;
} }
class FaultException extends Exception
{
static function create($faultString, $faultCode)
{
switch($faultString)
{
case 'Login unknown.':
return new LoginUnknownException($faultString, $faultCode);
}
return new self($faultString, $faultCode);
}
}
class LoginUnknownException extends FaultException {}
?> ?>

View File

@ -11,6 +11,12 @@ if(extension_loaded('xmlrpc'))
{ {
abstract class Request abstract class Request
{ {
private static $options = array(
'encoding' => 'utf-8',
'escaping' => 'markup',
'verbosity' => 'no_white_space'
);
/** /**
* @param string $method * @param string $method
* @param mixed[] $args * @param mixed[] $args
@ -18,7 +24,7 @@ if(extension_loaded('xmlrpc'))
*/ */
static function encode($method, $args) static function encode($method, $args)
{ {
return xmlrpc_encode_request($method, $args, array('encoding' => 'utf-8', 'verbosity' => 'no_white_space')); return xmlrpc_encode_request($method, $args, self::$options);
} }
/** /**