Back to CMSApplication class

Method __construct

public
__construct
(\Joomla\CMS\Input\Input $input = null, \Joomla\Registry\Registry $config = null, \Joomla\Application\Web\WebClient $client = null, \Joomla\DI\Container $container = null)
Class constructor.
Parameters
  • \Joomla\CMS\Input\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.
  • \Joomla\Registry\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.
  • \Joomla\Application\Web\WebClient $client An optional argument to provide dependency injection for the application's client object. If the argument is a WebClient object that object will become the application's client object, otherwise a default client object is created.
  • \Joomla\DI\Container $container Dependency injection container.
Since
  • 3.2

Method __construct - Source code

/**
 * Class constructor.
 *
 * @param   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.
 * @param   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.
 * @param   WebClient  $client     An optional argument to provide dependency injection for the application's client
 *                                 object.  If the argument is a WebClient object that object will become the
 *                                 application's client object, otherwise a default client object is created.
 * @param   Container  $container  Dependency injection container.
 *
 * @since   3.2
 */
public function __construct(Input $input = null, Registry $config = null, WebClient $client = null, Container $container = null)
{
    $container = $container ?: new Container();
    $this->setContainer($container);
    parent::__construct($input, $config, $client);
    // If JDEBUG is defined, load the profiler instance
    if (\defined('JDEBUG') && JDEBUG) {
        $this->profiler = Profiler::getInstance('Application');
    }
    // Enable sessions by default.
    if ($this->config->get('session') === null) {
        $this->config->set('session', true);
    }
    // Set the session default name.
    if ($this->config->get('session_name') === null) {
        $this->config->set('session_name', $this->getName());
    }
}