コード例 #1
0
 /**
  * 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);
 }
コード例 #2
0
ファイル: Application.php プロジェクト: simonfork/tagaliser
 /**
  * Execute the application.
  *
  * @return  void
  *
  * @since   1.0
  */
 public function execute()
 {
     // Check if help is needed.
     if ($this->input->get('h') || $this->input->get('help')) {
         $this->out('Tagaliser ' . self::VERSION);
         $this->out();
         $this->out('Usage:     php -f tagaliser.php -- [switches]');
         $this->out();
         $this->out('Switches:  -h | --help    Prints this usage information.');
         $this->out('           --user         The name of the Github user (associated with the repository).');
         $this->out('           --repo         The name of the Github repository.');
         $this->out('           --username     Your Github login username.');
         $this->out('           --password     Your Github login password.');
         $this->out('           --tag          Specifies a single tag to update.');
         $this->out('           --dry-run      Runs the application without adding any data.');
         $this->out('                          Use "Not tagged" to get the list of changes for the next tag.');
         $this->out('           --profile      Use a connection profile from the configuration file.');
         $this->out();
         $this->out('Examples:  php -f tagaliser.php -h');
         $this->out('           php -f tagaliser.php -- --user=foo --repo=bar');
         $this->out('           php -f tagaliser.php -- --tag=v1.0');
         $this->out('           php -f tagaliser.php -- --tag="Not tagged"');
         $this->out('           php -f tagaliser.php -- --dry-run');
         $this->out('           php -f tagaliser.php -- --profile=work');
         $this->out();
     } else {
         parent::execute();
     }
 }
コード例 #3
0
 /**
  * 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'));
 }
コード例 #4
0
ファイル: Application.php プロジェクト: houzhenggang/cobalt
 /**
  * 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();
 }
コード例 #5
0
ファイル: Application.php プロジェクト: elkuku/Jfw-app-base
 /**
  * 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')));
 }
コード例 #6
0
 /**
  * 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();
 }
コード例 #7
0
 /**
  * Test the getOutput() method.
  *
  * @return void
  */
 public function testGetOutput()
 {
     $this->assertInstanceOf('Joomla\\Application\\Cli\\Output\\Stdout', $this->instance->getOutput());
 }
コード例 #8
0
ファイル: Application.php プロジェクト: dextercowley/jissues
 /**
  * Write a string to standard output.
  *
  * @param   string   $text     The text to display.
  * @param   boolean  $newline  True (default) to append a new line at the end of the output string.
  *
  * @return  $this
  *
  * @codeCoverageIgnore
  * @since   1.0
  */
 public function out($text = '', $newline = true)
 {
     return $this->quiet ? $this : parent::out($text, $newline);
 }
コード例 #9
0
ファイル: Console.php プロジェクト: beingsane/quickcontent
 /**
  * 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();
 }