PHP Class ApiClient

Mostrar archivo Open project: fubralimited/php-oara Class Usage Examples

Public Methods

Method Description
factory ( string $protocol = PROTOCOL_DEFAULT, string $version = VERSION_DEFAULT ) : mixed Factory function returns a static instance of the ApiClient.

Private Methods

Method Description
__construct ( ) : void Make the constructor private to prevent the class being instantiated directly.
getInterface ( string $version, string $protocol ) : mixed Automatically includes the required ApiClient protocol class.

Method Details

factory() public static method

You can choose between three different api protocols. JSON, XML and SOAP are supported by the zanox api. If no version is given the latest version is always used. --- Usage example: creating api instance use soap api interface and the latest version $api = ApiClient::factory(PROTOCOL_SOAP, VERSION_DEFAULT); use xml api interface and the latest vesion $api = ApiClient::factory(PROTOCOL_XML, VERSION_DEFAULT); use json api interface and latest version $api = ApiClient::factory(PROTOCOL_JSON); ---
public static factory ( string $protocol = PROTOCOL_DEFAULT, string $version = VERSION_DEFAULT ) : mixed
$protocol string api protocol type (XML,JSON or SOAP)
$version string api version is optional
return mixed object on successful instantiation or false