IOInterface
abstract class IOInterface extends Singleton
Describes an abstract PHP I/O interface abstraction
Constants
| OUTPUT_PLAIN |
|
| OUTPUT_JSON |
|
| OUTPUT_PRINTR |
|
Properties
| static private | $instances | from Singleton | |
| protected Input[] | $inputs | ||
| protected | $outmode | ||
| private | $retfuncs | ||
| private | $numretfuncs |
Methods
Construct the singleton for use.
Constructs and returns a singleton of the appropriate interface type
Returns whether or not the interface is in use for this request
Returns whether or not the interface grants privileged access
Called during API construction to initialize the interface, e.g. to gather global arguments
Retrieves an array of input objects to run
No description
Asserts that only one output was given
Returns the address of the user on the interface
Returns the user agent string on the interface
Returns the debugging level requested by the interface
Returns the perf metrics level requested by the interface
Returns the path to the DB config file requested by the interface
Gets the default output mode for the interface
Sets the output mode to the given mode or null (none) - NOT USED in "multi-output" mode!
Registers a user output handler function to run after the initial commit
Returns true if the output is using multi-output mode
Returns the binary-packed version of the given integer size
Details
at line 97
__construct()
Construct the singleton for use.
This can be overriden if it requires more arguments
at line 36
static IOInterface|null
TryGet()
Constructs and returns a singleton of the appropriate interface type
at line 44
abstract static bool
isApplicable()
Returns whether or not the interface is in use for this request
at line 47
abstract static bool
isPrivileged()
Returns whether or not the interface grants privileged access
at line 50
void
Initialize()
Called during API construction to initialize the interface, e.g. to gather global arguments
at line 59
array
GetInputs(Config|null $config)
Retrieves an array of input objects to run
at line 66
abstract protected array
subGetInputs(Config|null $config)
No description
at line 69
void
DisallowBatch()
Asserts that only one output was given
at line 76
abstract string
getAddress()
Returns the address of the user on the interface
at line 79
abstract string
getUserAgent()
Returns the user agent string on the interface
at line 82
int
GetDebugLevel()
Returns the debugging level requested by the interface
at line 85
int
GetMetricsLevel()
Returns the perf metrics level requested by the interface
at line 88
string|null
GetDBConfigFile()
Returns the path to the DB config file requested by the interface
at line 93
abstract static int
GetDefaultOutmode()
Gets the default output mode for the interface
at line 100
IOInterface
SetOutputMode(int|null $mode)
Sets the output mode to the given mode or null (none) - NOT USED in "multi-output" mode!
at line 112
IOInterface
RegisterOutputHandler(OutputHandler $f)
Registers a user output handler function to run after the initial commit
Sets the output mode to null if bytes !== null and will cause "multi-output" mode to be used if > 1 functions that return > 0 bytes are defined
at line 135
protected bool
isMultiOutput()
Returns true if the output is using multi-output mode
Multi-output mode is used when more than one user output function wants to run. To accomodate this, each section will be prefaced with the number of bytes written. In multi-output mode, the requested global output mode is ignored and the request is always finished with JSON output (also with the # of bytes prefixed)
at line 142
static protected string
formatSize(int $size)
Returns the binary-packed version of the given integer size
unsigned long long (always 64 bit, big-endian byte order)
at line 148
bool
UserOutput(Output $output)
Tells the interface to run the custom user output functions
at line 163
abstract
WriteOutput(Output $output)
Tells the interface to print its final output