Class JApplicationCli

Description

Base class for a Joomla! command line application.

  • since: 11.4

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

JApplicationBase
   |
   --JApplicationCli
Direct descendents
Class Description
 class KeychainManager Keychain Manager
 class DeletefilesCli A command line cron job to attempt to remove files that should have been deleted at update.
 class FinderCli A command line cron job to run the Finder indexer.
 class GarbageCron Cron job to trash expired cache data
 class Updatecron This script will fetch the update information for all extensions and store them in the database, speeding up your administrator.
 class JApplicationDaemon Base class for a Joomla! command line application.
 class JCli Deprecated class placeholder. You should use JApplicationCli instead.
Variable Summary
Method Summary
 static JApplicationCli getInstance ([string $name = null])
 JApplicationCli __construct ([JInputCli $input = null], [JRegistry $config = null], [JEventDispatcher $dispatcher = null])
 void doExecute ()
 void execute ()
 mixed fetchConfigurationData ([string $file = ''], [string $class = 'JConfig'])
 mixed get (string $key, [mixed $default = null])
 string in ()
 JApplicationCli out ([string $text = ''], [boolean $nl = true])
 mixed set (string $key, [mixed $value = null])
Variables
static JApplicationCli $instance (line 31)
  • var: The application instance.
  • since: 11.1
  • access: protected
JRegistry $config (line 25)
  • var: The application configuration object.
  • since: 11.1
  • access: protected

Inherited Variables

Inherited from JApplicationBase

JApplicationBase::$dispatcher
JApplicationBase::$identity
JApplicationBase::$input
Methods
static getInstance (line 124)

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 50)

Class constructor.

JApplicationCli __construct ([JInputCli $input = null], [JRegistry $config = null], [JEventDispatcher $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 JEventDispatcher 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:
doExecute (line 290)

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 149)

Execute the application.

  • since: 11.1
  • access: public
void execute ()

Redefined in descendants as:
fetchConfigurationData (line 247)

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 108)

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 211)

Get a value from standard input.

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

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.
out (line 196)

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.
set (line 226)

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).

Inherited Methods

Inherited From JApplicationBase

 JApplicationBase::close()
 JApplicationBase::getIdentity()
 JApplicationBase::loadDispatcher()
 JApplicationBase::loadIdentity()
 JApplicationBase::registerEvent()
 JApplicationBase::triggerEvent()

Documentation generated on Tue, 19 Nov 2013 14:55:45 +0100 by phpDocumentor 1.4.3