PHP Class Jyxo\Rpc\Server

Author: Jaroslav HanslĂ­k
Datei anzeigen Open project: jyxo/php Class Usage Examples

Public Methods

Method Description
__clone ( ) Prevents from singleton cloning.
__destruct ( ) Destroys a class instance.
enableLogging ( string $filename, callable $callback = null ) : self Turns on logging.
getInstance ( ) : self Returns class instance.
process ( ) Processes a request and sends a RPC response.
registerClass ( string $class, boolean $useFullName = true ) : self Registers class public methods.
registerFunc ( string $func ) : self Registers given function.
registerMethod ( string $class, string $method, boolean $useFullName = true ) : self Registers given method of given class.

Protected Methods

Method Description
__construct ( ) Creates a class instance.
call ( string $method, array $params ) : mixed Calls a server method with given parameters.
register ( string $func ) Actually registers a function to a server method.

Private Methods

Method Description
log ( string $method, array $params, mixed $result ) Logs a request.

Method Details

__clone() final public method

Prevents from singleton cloning.
final public __clone ( )

__construct() protected method

Creates a class instance.
protected __construct ( )

__destruct() public method

Destroys a class instance.
public __destruct ( )

call() protected method

Calls a server method with given parameters.
protected call ( string $method, array $params ) : mixed
$method string Method name
$params array Method parameters
return mixed

enableLogging() public method

Turns on logging.
public enableLogging ( string $filename, callable $callback = null ) : self
$filename string Log file path.
$callback callable Function to be called prior to logging a message.
return self

getInstance() public static method

Returns class instance.
public static getInstance ( ) : self
return self

process() abstract public method

Processes a request and sends a RPC response.
abstract public process ( )

register() abstract protected method

Actually registers a function to a server method.
abstract protected register ( string $func )
$func string Function name

registerClass() public method

Registers class public methods.
public registerClass ( string $class, boolean $useFullName = true ) : self
$class string Class name
$useFullName boolean Register with class name
return self

registerFunc() public method

Registers given function.
public registerFunc ( string $func ) : self
$func string Function name
return self

registerMethod() public method

Method does not necessarily have to exist if __call or __callStatic method is defined.
public registerMethod ( string $class, string $method, boolean $useFullName = true ) : self
$class string Class name
$method string Function name
$useFullName boolean Register with class name
return self