class BaseApplication extends AbstractApplication

Joomla Platform Base Application Class

Methods

__construct( Input $input = null, Registry $config = null)

Class constructor.

mixed
getIdentity()

Get the application identity.

registerEvent( string $event, callable $handler)

Registers a handler to a particular event group.

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

Calls all handlers associated with an event group.

loadDispatcher( JEventDispatcher $dispatcher = null)

Allows the application to load a custom or default dispatcher.

loadIdentity( JUser $identity = null)

Allows the application to load a custom or default identity.

Details

__construct( Input $input = null, Registry $config = null)

Class constructor.

Parameters

Input $input An optional argument to provide dependency injection for the application's input object. If the argument is a \JInput object that object will become the application's input object, otherwise a default input object is created.
Registry $config An optional argument to provide dependency injection for the application's config object. If the argument is a Registry object that object will become the application's config object, otherwise a default config object is created.

mixed getIdentity()

Get the application identity.

Return Value

mixed A \JUser object or null.

BaseApplication registerEvent( string $event, callable $handler)

Registers a handler to a particular event group.

Parameters

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

Return Value

BaseApplication The application to allow chaining.

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

Return Value

array An array of results from each function call, or null if no dispatcher is defined.

BaseApplication loadDispatcher( JEventDispatcher $dispatcher = null)

Allows the application to load a custom or default dispatcher.

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, if required, based on more specific needs.

Parameters

JEventDispatcher $dispatcher An optional dispatcher object. If omitted, the factory dispatcher is created.

Return Value

BaseApplication This method is chainable.

BaseApplication loadIdentity( JUser $identity = null)

Allows the application to load a custom or default identity.

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 an identity, if required, based on more specific needs.

Parameters

JUser $identity An optional identity object. If omitted, the factory user is created.

Return Value

BaseApplication This method is chainable.