class JCli


Located at : UKNOWVA_ROOT/libraries/joomla/application/cli.php

Base class for a Joomla! command line application.

Properties

JInput $input The application input object.

Methods

static JCli
getInstance(string $name = null)

Returns a reference to the global JCli object, only creating it if it doesn't already exist.

void
execute()

Execute the application.

void
close(integer $code)

Exit the application.

void
loadConfiguration(mixed $data)

Load an object or array into the application configuration object.

void
out(string $text = '', boolean $nl = true)

Write a string to standard output.

string
in()

Get a value from standard input.

void
registerEvent(string $event, callback $handler)

Registers a handler to a particular event group.

array
triggerEvent(string $event, array $args = null)

Calls all handlers associated with an event group.

mixed
get(string $key, mixed $default = null)

Returns a property of the object or the default value if the property is not set.

mixed
set(string $key, mixed $value = null)

Modifies a property of the object, creating it if it does not already exist.

Details

at line 96
static JCli getInstance(string $name = null)

Returns a reference to the global JCli object, only creating it if it doesn't already exist.

This method must be invoked as: $cli = JCli::getInstance();

Parameters

string $name The name of the JCli class to instantiate.

Return Value

JCli A JCli object

at line 118
void execute()

Execute the application.

Return Value

void

at line 132
void close(integer $code)

Exit the application.

Parameters

integer $code Exit code.

Return Value

void

at line 146
void loadConfiguration(mixed $data)

Load an object or array into the application configuration object.

Parameters

mixed $data Either an array or object to be loaded into the configuration object.

Return Value

void

at line 167
void out(string $text = '', boolean $nl = true)

Write a string to standard output.

Parameters

string $text The text to display.
boolean $nl True to append a new line at the end of the output string.

Return Value

void

at line 179
string in()

Get a value from standard input.

Return Value

string The input string from standard input.

at line 194
void registerEvent(string $event, callback $handler)

Registers a handler to a particular event group.

Parameters

string $event The event name.
callback $handler The handler, a function or an instance of a event object.

Return Value

void

at line 209
array triggerEvent(string $event, array $args = null)

Calls all handlers associated with an event group.

Parameters

string $event The event name.
array $args An array of arguments.

Return Value

array An array of results from each function call.

at line 224
mixed get(string $key, mixed $default = null)

Returns a property of the object or the default value if the property is not set.

Parameters

string $key The name of the property
mixed $default The default value if none is set.

Return Value

mixed The value of the configuration.

at line 239
mixed set(string $key, mixed $value = null)

Modifies a property of the object, creating it if it does not already exist.

Parameters

string $key The name of the property
mixed $value The value of the property to set

Return Value

mixed Previous value of the property