PHP Class Horde_Rpc, horde

TODO: - Introspection documentation and method signatures. EXAMPLE: $response = Horde_Rpc::request('xmlrpc', 'http://localhost:80/horde/rpc.php', 'contacts.search', $transport_client, array(array('jan'), array('localsql'), array('name', 'email')));
Author: Jan Schneider ([email protected])
Show file Open project: horde/horde Class Usage Examples

Protected Properties

Property Type Description
$_logger Horde_Log_Logger Logging
$_params array All driver-specific parameters.
$_request Horde_Controller_Request_Http ..
$_requestMissingAuthorization boolean Whether we should exit if auth fails instead of requesting authorization credentials.
$_requireAuthorization boolean Do we need an authenticated user?

Public Methods

Method Description
__construct ( Horde_Controller_Request_Http $request, array $params = [] ) Constructor.
authorize ( ) : boolean Check authentication. Different backends may handle authentication in different ways. The base class implementation checks for HTTP Authentication against the Horde auth setup.
factory ( mixed $driver, $request, array $params = null ) : Horde_Rpc Attempts to return a concrete RPC server instance based on $driver.
getInput ( ) : mixed Get the request body input. Different RPC backends can override this to return an open stream to php://stdin, for instance - whatever is easiest to handle in the getResponse() method.
getResponse ( $request ) : string Sends an RPC request to the server implementation and returns the result.
getResponseContentType ( ) : string Returns the Content-Type of the response.
request ( string $driver, string | Horde_Url $url, string $method, mixed $client, array $params = null ) : mixed Builds an RPC request and sends it to the RPC server.
sendOutput ( string $output ) : void Send the output back to the client

Method Details

__construct() public method

Constructor.
public __construct ( Horde_Controller_Request_Http $request, array $params = [] )
$request Horde_Controller_Request_Http The request object.
$params array A hash containing any additional configuration or connection parameters a subclass might need.

authorize() public method

Check authentication. Different backends may handle authentication in different ways. The base class implementation checks for HTTP Authentication against the Horde auth setup.
public authorize ( ) : boolean
return boolean Returns true if authentication is successful. Should send appropriate "not authorized" headers or other response codes/body if auth fails, and take care of exiting.

factory() public static method

Attempts to return a concrete RPC server instance based on $driver.
public static factory ( mixed $driver, $request, array $params = null ) : Horde_Rpc
$driver mixed The type of concrete Horde_Rpc subclass to return.
$params array A hash containing any additional configuration or connection parameters a subclass might need.
return Horde_Rpc The newly created concrete Horde_Rpc server instance, or an exception if there is an error.

getInput() public method

The base class implementation looks for $HTTP_RAW_POST_DATA and returns that if it's available; otherwise, it returns the contents of php://stdin.
public getInput ( ) : mixed
return mixed The input - a string (default), a filehandle, etc.

getResponse() public method

Sends an RPC request to the server implementation and returns the result.
public getResponse ( $request ) : string
return string The response from the server.

getResponseContentType() public method

Returns the Content-Type of the response.
public getResponseContentType ( ) : string
return string The MIME Content-Type of the RPC response.

request() public static method

This statically called method is actually the RPC client.
public static request ( string $driver, string | Horde_Url $url, string $method, mixed $client, array $params = null ) : mixed
$driver string The protocol driver to use. Currently 'soap', 'xmlrpc' and 'jsonrpc' are available.
$url string | Horde_Url The path to the RPC server on the called host.
$method string The method to call.
$client mixed An appropriate request client for the type of request. (Horde_Http_Request, SoapClient etc..)
$params array A hash containing any necessary parameters for the method call.
return mixed The returned result from the method

sendOutput() public method

Send the output back to the client
public sendOutput ( string $output ) : void
$output string The output to send back to the client. Can be overridden in classes if needed.
return void

Property Details

$_logger protected property

Logging
protected Horde_Log_Logger $_logger
return Horde_Log_Logger

$_params protected property

All driver-specific parameters.
protected array $_params
return array

$_request protected property

..
protected Horde_Controller_Request_Http $_request
return Horde_Controller_Request_Http

$_requestMissingAuthorization protected property

Whether we should exit if auth fails instead of requesting authorization credentials.
protected bool $_requestMissingAuthorization
return boolean

$_requireAuthorization protected property

Do we need an authenticated user?
protected bool $_requireAuthorization
return boolean