XRL  latest
Simple XML-RPC Library (both client and server)
fpoirotte\XRL\CLI Class Reference

A class that implements a simple CLI script to send XML-RPC queries and to display their result. More...

Public Member Functions

 printUsage ($output, $prog)
 
 run (array $args)
 

Static Public Member Functions

static getCopyrightAndLicense ()
 
static getVersion ()
 

Protected Member Functions

 parse (array $args)
 
 parseBool ($value)
 
 parseFile ($value)
 
 parseParam (array &$args,\DateTimeZone $timezone)
 
 parseTimestamp ($value)
 

Detailed Description

A class that implements a simple CLI script to send XML-RPC queries and to display their result.

Authors
François Poirotte click.nosp@m.y@er.nosp@m.ebot..nosp@m.net

Definition at line 22 of file CLI.php.

Member Function Documentation

static fpoirotte\XRL\CLI::getCopyrightAndLicense ( )
static

Return XRL's copyright and license information.

Return values
stringFull copyright and license information.

Definition at line 69 of file CLI.php.

static fpoirotte\XRL\CLI::getVersion ( )
static

Return XRL's version.

Return values
stringXRL's version, or "dev" if the version information could not be retrieved.

Definition at line 31 of file CLI.php.

Referenced by fpoirotte\XRL\Client\__call().

fpoirotte\XRL\CLI::parse ( array  $args)
protected

Parse the arguments passed to this script.

Parameters
array$argsA list with the arguments passed to this script.
Return values
arrayAn array of ($options,$params) for this script.
Exceptions
ExceptionSome error occurred during the parsing. See the exception's message for more information.

Definition at line 340 of file CLI.php.

References fpoirotte\XRL\CLI\parseParam().

Referenced by fpoirotte\XRL\CLI\run().

fpoirotte\XRL\CLI::parseBool (   $value)
protected

Parse a boolean out of some text. "0", "off" or "false" can be used to represent false while "1", "on" or "true" can used to represent true.

Parameters
string$valueSome text that's supposed to represent a boolean value.
Return values
boolThe value that was parsed.
Exceptions
ExceptionThe given text did not contain a boolean value.

Definition at line 121 of file CLI.php.

fpoirotte\XRL\CLI::parseFile (   $value)
protected

Return the content of a file.

Parameters
string$valueName of the file to read.
Return values
stringThe content of that file.
Exceptions
ExceptionThe file did not exist or its content could not be read.

Definition at line 146 of file CLI.php.

fpoirotte\XRL\CLI::parseParam ( array &  $args,
\DateTimeZone  $timezone 
)
protected

Parse this script's arguments and extract parameters.

Parameters
array$argsArguments that contain parameters for an XML-RPC request, using the notation this script expects.
DateTimeZone$timezoneTimezone information (used to parse date/times).
Return values
arrayThe parameters for an XML-RPC request that were parsed by this method.
Exceptions
ExceptionSome error occurred during the parsing. See the exception's message for more information.
Note
The list of arguments passed to this method is modified as it is parsed.

Definition at line 208 of file CLI.php.

Referenced by fpoirotte\XRL\CLI\parse().

fpoirotte\XRL\CLI::parseTimestamp (   $value)
protected

Parse a date/time value and return a DateTime object for it.

Parameters
string$valueA date/time value, using any of the compound formats supported by PHP.
Return values
DateTimeAn object representing that date/time.
Exceptions
ExceptionThe given value did not refer to a valid date/time.
Note
See http://php.net/datetime.formats.compound for a list of compound formats PHP supports.

Definition at line 174 of file CLI.php.

fpoirotte\XRL\CLI::printUsage (   $output,
  $prog 
)

Display this script's usage.

Parameters
fpoirotte::XRL::Output$outputOutput where usage information will be sent.
string$progThe name of this script, ie. $_SERVER['argv'][0]

Definition at line 93 of file CLI.php.

Referenced by fpoirotte\XRL\CLI\run().

fpoirotte\XRL\CLI::run ( array  $args)

Run this CLI script.

Parameters
array$argsA list of arguments passed to this script.
Return values
intExit code. 0 is used to indicate a success, while any other code indicates an error.
Note
In case of an error, additional messages may be sent to STDERR by this script.

Definition at line 426 of file CLI.php.

References fpoirotte\XRL\CLI\parse(), and fpoirotte\XRL\CLI\printUsage().


The documentation for this class was generated from the following file: