/** * Overrides JGithub constructor to initialise the api property. * * @param 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. * @param 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. * @param mixed $dispatcher An optional argument to provide dependency injection for the application's * event dispatcher. If the argument is a JDispatcher 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. * * @see loadDispatcher() * @since 11.1 */ public function __construct() { parent::__construct(); $options = new Registry(); $options->set('headers.Accept', 'application/vnd.github.html+json'); $this->api = new Github($options); }
/** * Class constructor * * @since 1.0 */ public function __construct() { $container = (new Container())->registerServiceProvider(new ConfigurationProvider())->registerServiceProvider(new DatabaseProvider())->registerServiceProvider(new TwigRendererProvider($this)); $this->setContainer($container); // Set error reporting based on config $errorReporting = (int) $container->get('config')->get('errorReporting', 0); error_reporting($errorReporting); parent::__construct(null, $container->get('config')); }
/** * Constructor * * @since 1.0 */ public function __construct() { $container = Container::getInstance(); $container->registerServiceProvider(new ApplicationServiceProvider($this))->registerServiceProvider(new ConfigServiceProvider())->registerServiceProvider(new DatabaseServiceProvider()); $this->setContainer($container); // Set error reporting based on config $errorReporting = (int) $container->get('config')->get('errorReporting', 0); error_reporting($errorReporting); parent::__construct(); }
/** * Class constructor. * * @param Cli $input An optional argument to provide dependency injection for the application's * input object. If the argument is a InputCli 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. */ public function __construct(Cli $input = null, Registry $config = null) { parent::__construct($input, $config); // Build the DI Container $this->container = (new Container())->registerServiceProvider(new ApplicationProvider($this))->registerServiceProvider(new ConfigurationProvider($this->config)); $this->commandOptions[] = new CommandOption('quiet', 'q', 'Be quiet - suppress output.'); $this->commandOptions[] = new CommandOption('verbose', 'v', 'Verbose output for debugging purpose.'); $this->commandOptions[] = new CommandOption('nocolors', '', 'Suppress ANSI colors on unsupported terminals.'); $this->commandOptions[] = new CommandOption('--log=filename.log', '', 'Optionally log output to the specified log file.'); $this->getOutput()->setProcessor(new ColorProcessor()); /* @type ColorProcessor $processor */ $processor = $this->getOutput()->getProcessor(); if ($this->input->get('nocolors') || !$this->get('cli-application.colors')) { $processor->noColors = true; } // Setup app colors (also required in "nocolors" mode - to strip them). $processor->addStyle('b', new ColorStyle('', '', array('bold')))->addStyle('title', new ColorStyle('yellow', '', array('bold')))->addStyle('ok', new ColorStyle('green', '', array('bold'))); }
/** * Class constructor. * * @param Cli $input An optional argument to provide dependency injection for the application's * input object. If the argument is a InputCli 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. * * @since 1.0 * @throws \RuntimeException */ public function __construct(Cli $input = null, Registry $config = null) { // Verify that the process control extension for PHP is available. // @codeCoverageIgnoreStart if (!defined('SIGHUP')) { $this->getLogger()->error('The PCNTL extension for PHP is not available.'); throw new \RuntimeException('The PCNTL extension for PHP is not available.'); } // Verify that POSIX support for PHP is available. if (!function_exists('posix_getpid')) { $this->getLogger()->error('The POSIX extension for PHP is not available.'); throw new \RuntimeException('The POSIX extension for PHP is not available.'); } // @codeCoverageIgnoreEnd // Call the parent constructor. parent::__construct($input, $config); // Set some system limits. @set_time_limit($this->get('max_execution_time', 0)); if ($this->get('max_memory_limit') !== null) { ini_set('memory_limit', $this->get('max_memory_limit', '256M')); } // Flush content immediately. ob_implicit_flush(); }
/** * Class constructor. * * @param Input\Cli $input An optional argument to provide dependency injection for the application's * input object. If the argument is a InputCli 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. * * @since 1.0 */ public function __construct(Input\Cli $input = null, Registry $config = null) { parent::__construct($input, $config); // Build the DI Container $this->container = (new Container())->registerServiceProvider(new ApplicationProvider($this))->registerServiceProvider(new ConfigurationProvider($this->config))->registerServiceProvider(new DatabaseProvider())->registerServiceProvider(new GitHubProvider())->registerServiceProvider(new DebuggerProvider())->registerServiceProvider(new LoggerProvider($this->input->get('log'), $this->input->get('quiet', $this->input->get('q'))))->registerServiceProvider(new TransifexProvider()); $this->loadLanguage(); $this->commandOptions[] = new TrackerCommandOption('quiet', 'q', g11n3t('Be quiet - suppress output.')); $this->commandOptions[] = new TrackerCommandOption('verbose', 'v', g11n3t('Verbose output for debugging purpose.')); $this->commandOptions[] = new TrackerCommandOption('nocolors', '', g11n3t('Suppress ANSI colors on unsupported terminals.')); $this->commandOptions[] = new TrackerCommandOption('--log=filename.log', '', g11n3t('Optionally log output to the specified log file.')); $this->getOutput()->setProcessor(new ColorProcessor()); /* @type ColorProcessor $processor */ $processor = $this->getOutput()->getProcessor(); if ($this->input->get('nocolors') || !$this->get('cli-application.colors')) { $processor->noColors = true; } // Setup app colors (also required in "nocolors" mode - to strip them). $processor->addStyle('b', new ColorStyle('', '', array('bold')))->addStyle('title', new ColorStyle('yellow', '', array('bold')))->addStyle('ok', new ColorStyle('green', '', array('bold'))); $this->usePBar = $this->get('cli-application.progress-bar'); if ($this->input->get('noprogress')) { $this->usePBar = false; } // Register the global dispatcher $this->setDispatcher(new Dispatcher()); }
/** * Class constructor. * * @param Input\Cli $input An optional argument to provide dependency injection for the application's * input object. If the argument is a InputCli 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 CliOutput $output The output handler. * * @since 1.0 */ public function __construct(Input\Cli $input = null, Registry $config = null, CliOutput $output = null) { parent::__construct($input, $config, $output); $this->registerRootCommand(); }