CLI
class CLI extends IOInterface
The interface for using Andromeda via local console
Constants
| OUTPUT_PLAIN |
|
| OUTPUT_JSON |
|
| OUTPUT_PRINTR |
|
Properties
| static private | $instances | from Singleton | |
| protected Input[] | $inputs | from IOInterface | |
| protected | $outmode | from IOInterface | |
| private | $retfuncs | from IOInterface | |
| private | $numretfuncs | from IOInterface | |
| private | $debug | ||
| private | $metrics | ||
| private | $dbconf |
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
No description
Initializes CLI by fetching some global params from $argv
No description
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
No description
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 the binary-packed version of the given integer size
Strips -- off the given string and returns (or false if not found)
Returns the next args value (or null if not found) and increments $i
Reads an array of Input objects from a batch file
Details
at line 62
__construct()
Construct the singleton for use.
This can be overriden if it requires more arguments
in
IOInterface at line 36
static IOInterface|null
TryGet()
Constructs and returns a singleton of the appropriate interface type
at line 54
static bool
isApplicable()
Returns whether or not the interface is in use for this request
at line 60
static bool
isPrivileged()
No description
at line 95
void
Initialize()
Initializes CLI by fetching some global params from $argv
Options such as output mode, debug level and DB config file should be fetched here before the actual GetInputs() is run later. These options are global, not specific to a single Input instance
in
IOInterface at line 59
array
GetInputs(Config|null $config)
Retrieves an array of input objects to run
at line 155
protected array
subGetInputs(Config|null $config)
No description
in
IOInterface at line 69
void
DisallowBatch()
Asserts that only one output was given
at line 133
string
getAddress()
Returns the address of the user on the interface
at line 138
string
getUserAgent()
Returns the user agent string on the interface
at line 144
int
GetDebugLevel()
Returns the debugging level requested by the interface
at line 147
int
GetMetricsLevel()
Returns the perf metrics level requested by the interface
at line 150
string|null
GetDBConfigFile()
Returns the path to the DB config file requested by the interface
at line 153
static int
GetDefaultOutmode()
No description
in
IOInterface 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!
in
IOInterface 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
in
IOInterface 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)
in
IOInterface 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)
in
IOInterface at line 148
bool
UserOutput(Output $output)
Tells the interface to run the custom user output functions
at line 298
WriteOutput(Output $output)
Tells the interface to print its final output
at line 77
static private
getKey(string $str)
Strips -- off the given string and returns (or false if not found)
at line 83
static private string|null
getNextValue(array $args, int $i)
Returns the next args value (or null if not found) and increments $i
at line 207
private array
GetBatch(string $file)
Reads an array of Input objects from a batch file
at line 220
private Input
GetInput(array $argv)
Fetches an Input object by reading it from the command line