Class JApplicationCli

Description

Base class for a Joomla! command line application.

  • since: 11.4

Located in /libraries/joomla/application/cli.php (line 22)


	
			
Direct descendents
Class Description
JCli Deprecated class placeholder. You should use JApplicationCli instead.
JApplicationDaemon Base class for a Joomla! command line application.
FinderCli A command line cron job to run the Finder indexer.
GarbageCron Cron job to trash expired cache data
Updatecron This script will fetch the update information for all extensions and store them in the database, speeding up your administrator.
Variable Summary
Method Summary
static JApplicationCli getInstance ([string $name = null])
JApplicationCli __construct ([JInputCli $input = null], [JRegistry $config = null], [JDispatcher $dispatcher = null])
void close ([integer $code = 0])
void doExecute ()
void execute ()
mixed fetchConfigurationData ([string $file = ''], [string $class = 'JConfig'])
mixed get (string $key, [mixed $default = null])
string in ()
void loadDispatcher ()
JApplicationCli out ([string $text = ''], [boolean $nl = true])
JApplicationCli registerEvent (string $event, callback $handler)
mixed set (string $key, [mixed $value = null])
array triggerEvent (string $event, [array $args = null])
Variables
static JApplicationCli $instance (line 46)
  • var: The application instance.
  • since: 11.1
  • access: protected
JRegistry $config (line 34)
  • var: The application configuration object.
  • since: 11.1
  • access: protected
JDispatcher $dispatcher (line 40)
  • var: The application dispatcher object.
  • since: 11.1
  • access: protected
JInputCli $input (line 28)
  • var: The application input object.
  • since: 11.1
  • access: public
Methods
static method getInstance (line 149)

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

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

  • since: 11.1
  • access: public
static JApplicationCli getInstance ([string $name = null])
  • string $name: The name (optional) of the JApplicationCli class to instantiate.
Constructor __construct (line 65)

Class constructor.

JApplicationCli __construct ([JInputCli $input = null], [JRegistry $config = null], [JDispatcher $dispatcher = null])
  • mixed $input: An optional argument to provide dependency injection for the application's input object. If the argument is a JInputCli object that object will become the application's input object, otherwise a default input object is created.
  • mixed $config: An optional argument to provide dependency injection for the application's config object. If the argument is a JRegistry object that object will become the application's config object, otherwise a default config object is created.
  • mixed $dispatcher: An optional argument to provide dependency injection for the application's event dispatcher. If the argument is a JDispatcher object that object will become the application's event dispatcher, if it is null then the default event dispatcher will be created based on the application's loadDispatcher() method.

Redefined in descendants as:
close (line 210)

Exit the application.

  • since: 11.1
  • access: public
void close ([integer $code = 0])
  • integer $code: The exit code (optional; default is 0).
doExecute (line 195)

Method to run the application routines. Most likely you will want to instantiate a controller and execute it, or perform some sort of task directly.

  • since: 11.3
  • access: protected
void doExecute ()

Redefined in descendants as:
execute (line 174)

Execute the application.

  • since: 11.1
  • access: public
void execute ()
fetchConfigurationData (line 341)

Method to load a PHP configuration class file based on convention and return the instantiated data object. You will extend this method in child classes to provide configuration data from whatever data source is relevant for your specific application.

  • return: Either an array or object to be loaded into the configuration object.
  • since: 11.1
  • access: protected
mixed fetchConfigurationData ([string $file = ''], [string $class = 'JConfig'])
  • string $file: The path and filename of the configuration file. If not provided, configuration.php in JPATH_BASE will be used.
  • string $class: The class name to instantiate.
get (line 133)

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

  • return: The value of the configuration.
  • since: 11.3
  • access: public
mixed get (string $key, [mixed $default = null])
  • string $key: The name of the property.
  • mixed $default: The default value (optional) if none is set.
in (line 265)

Get a value from standard input.

  • return: The input string from standard input.
  • since: 11.1
  • access: public
string in ()
loadConfiguration (line 224)

Load an object or array into the application configuration object.

  • return: Instance of $this to allow chaining.
  • since: 11.1
  • access: public
JApplicationCli loadConfiguration (mixed $data)
  • mixed $data: Either an array or object to be loaded into the configuration object.
loadDispatcher (line 384)

Method to create an event dispatcher for the application. The logic and options for creating this object are adequately generic for default cases but for many applications it will make sense to override this method and create event dispatchers based on more specific needs.

  • since: 11.3
  • access: protected
void loadDispatcher ()
out (line 250)

Write a string to standard output.

  • return: Instance of $this to allow chaining.
  • since: 11.1
  • access: public
JApplicationCli out ([string $text = ''], [boolean $nl = true])
  • string $text: The text to display.
  • boolean $nl: True (default) to append a new line at the end of the output string.
registerEvent (line 280)

Registers a handler to a particular event group.

  • return: Instance of $this to allow chaining.
  • since: 11.1
  • access: public
JApplicationCli registerEvent (string $event, callback $handler)
  • string $event: The event name.
  • callback $handler: The handler, a function or an instance of a event object.
set (line 320)

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

  • return: Previous value of the property
  • since: 11.3
  • access: public
mixed set (string $key, [mixed $value = null])
  • string $key: The name of the property.
  • mixed $value: The value of the property to set (optional).
triggerEvent (line 300)

Calls all handlers associated with an event group.

  • return: An array of results from each function call, or null if no dispatcher is defined.
  • since: 11.1
  • access: public
array triggerEvent (string $event, [array $args = null])
  • string $event: The event name.
  • array $args: An array of arguments (optional).

Documentation generated on Mon, 25 Jun 2012 13:53:03 -0500 by phpDocumentor 1.4.4