Back to WebApplication class

Method __construct

public
__construct
(\Joomla\CMS\Input\Input $input = null, \Joomla\Registry\Registry $config = null, \Joomla\Application\Web\WebClient $client = null, \Psr\Http\Message\ResponseInterface $response = 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.
  • \Psr\Http\Message\ResponseInterface $response An optional argument to provide dependency injection for the application's response object. If the argument is a ResponseInterface object that object will become the application's response object, otherwise a default response object is created.
Since
  • 1.7.3

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   ResponseInterface  $response  An optional argument to provide dependency injection for the application's
 *                                        response object.  If the argument is a ResponseInterface object that object
 *                                        will become the application's response object, otherwise a default response
 *                                        object is created.
 *
 * @since   1.7.3
 */
public function __construct(Input $input = null, Registry $config = null, WebClient $client = null, ResponseInterface $response = null)
{
    // Ensure we have a CMS Input object otherwise the DI for \Joomla\CMS\Session\Storage\JoomlaStorage fails
    $input = $input ?: new Input();
    parent::__construct($input, $config, $client, $response);
    // Set the execution datetime and timestamp;
    $this->set('execution.datetime', gmdate('Y-m-d H:i:s'));
    $this->set('execution.timestamp', time());
    // Set the system URIs.
    $this->loadSystemUris();
}