Back to DaemonApplication class

Method __construct

public
__construct
(\Joomla\CMS\Input\Cli $input = null, \Joomla\Registry\Registry $config = null, \Joomla\Event\DispatcherInterface $dispatcher = null)
Class constructor.
Parameters
  • \Joomla\CMS\Input\Cli $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.
  • \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\Event\DispatcherInterface $dispatcher An optional argument to provide dependency injection for the application's event dispatcher. If the argument is a DispatcherInterface 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.
Since
  • 1.7.0

Method __construct - Source code

/**
 * Class constructor.
 *
 * @param   Cli                  $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.
 * @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   DispatcherInterface  $dispatcher  An optional argument to provide dependency injection for the application's
 *                                            event dispatcher.  If the argument is a DispatcherInterface 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.
 *
 * @since   1.7.0
 */
public function __construct(Cli $input = null, Registry $config = null, DispatcherInterface $dispatcher = null)
{
    // Verify that the process control extension for PHP is available.
    if (!\defined('SIGHUP')) {
        Log::add('The PCNTL extension for PHP is not available.', Log::ERROR);
        throw new \RuntimeException('The PCNTL extension for PHP is not available.');
    }
    // Verify that POSIX support for PHP is available.
    if (!\function_exists('posix_getpid')) {
        Log::add('The POSIX extension for PHP is not available.', Log::ERROR);
        throw new \RuntimeException('The POSIX extension for PHP is not available.');
    }
    // Call the parent constructor.
    parent::__construct($input, $config, null, null, $dispatcher);
    // Set some system limits.
    @set_time_limit($this->config->get('max_execution_time', 0));
    if ($this->config->get('max_memory_limit') !== null) {
        ini_set('memory_limit', $this->config->get('max_memory_limit', '256M'));
    }
    // Flush content immediately.
    ob_implicit_flush();
}