configureIO() защищенный метод

Configures the input and output instances based on the user arguments and options.
protected configureIO ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
$input Symfony\Component\Console\Input\InputInterface An InputInterface instance
$output Symfony\Component\Console\Output\OutputInterface An OutputInterface instance
Пример #1
0
 /**
  * @inheritdoc
  */
 protected function configureIO(InputInterface $input, OutputInterface $output)
 {
     parent::configureIO($input, $output);
     // code style
     $code = new OutputFormatterStyle('black', 'white');
     $output->getFormatter()->setStyle('code', $code);
 }
Пример #2
0
 protected function configureIO(InputInterface $input, OutputInterface $output)
 {
     parent::configureIO($input, $output);
     $formatter = $output->getFormatter();
     $formatter->setStyle('fail', new OutputFormatterStyle('red'));
     $formatter->setStyle('highlight', new OutputFormatterStyle('blue', null, array('bold')));
 }
 /**
  * @param InputInterface  $input
  * @param OutputInterface $output
  */
 protected function configureIO(InputInterface $input, OutputInterface $output)
 {
     parent::configureIO($input, $output);
     if (null !== $this->container) {
         $this->container->set('console.input', $input);
         $this->container->set('console.output', $output);
     }
 }
Пример #4
0
 /**
  * {@inheritdoc}
  */
 protected function configureIO(InputInterface $input, OutputInterface $output)
 {
     parent::configureIO($input, $output);
     $formatter = $output->getFormatter();
     $formatter->setStyle('warning', new OutputFormatterStyle('white', 'blue', ['bold']));
     $formatter->setStyle('url', new OutputFormatterStyle('blue'));
     $formatter->setStyle('bold', new OutputFormatterStyle(null, null, ['bold']));
 }
Пример #5
0
 protected function configureIO(InputInterface $input, OutputInterface $output)
 {
     if (true === $input->hasParameterOption(array('--colors'))) {
         $output->setDecorated(true);
     } elseif (true === $input->hasParameterOption(array('--no-colors'))) {
         $output->setDecorated(false);
     }
     parent::configureIO($input, $output);
 }
Пример #6
0
 /**
  * Configures the input and output instances based on the user arguments and options.
  *
  * @param InputInterface $input An InputInterface instance
  * @param OutputInterface $output An OutputInterface instance
  */
 protected function configureIO(InputInterface $input, OutputInterface $output)
 {
     foreach ($this->getHelperSet()->getIterator() as $helper) {
         if ($helper instanceof AbstractHelper) {
             $helper->setWorkingDirectory(getcwd() . DIRECTORY_SEPARATOR);
             $helper->setIO($input, $output);
             $helper->init();
         }
     }
     parent::configureIO($input, $output);
     // TODO: Change the autogenerated stub
 }
Пример #7
0
 protected function configureIO(InputInterface $input, OutputInterface $output)
 {
     parent::configureIO($input, $output);
     $level = Logger::DEBUG;
     switch ($output->getVerbosity()) {
         case OutputInterface::VERBOSITY_VERY_VERBOSE:
             $level = Logger::INFO;
             break;
         case OutputInterface::VERBOSITY_VERBOSE:
             $level = Logger::NOTICE;
             break;
         case OutputInterface::VERBOSITY_DEBUG:
             $level = Logger::DEBUG;
             break;
         case OutputInterface::VERBOSITY_NORMAL:
             $level = Logger::WARNING;
             break;
         case OutputInterface::VERBOSITY_QUIET:
             $level = Logger::CRITICAL;
             break;
     }
     $handler = new ConsoleHandler($level);
     $handler->install();
 }
Пример #8
0
 /**
  * {@inheritdoc}
  */
 protected function configureIO(InputInterface $input, OutputInterface $output)
 {
     parent::configureIO($input, $output);
     $output->getFormatter()->setStyle('greenbg', new OutputFormatterStyle('black', 'green', array()));
 }
Пример #9
0
 /**
  * Configure IO of GrumPHP objects
  *
  * @param InputInterface  $input
  * @param OutputInterface $output
  */
 protected function configureIO(InputInterface $input, OutputInterface $output)
 {
     parent::configureIO($input, $output);
     $container = $this->getContainer();
     $io = new ConsoleIO($input, $output);
     // Overwrite the nullIO with the console IO.
     $container->set('grumphp.io.console', $io);
     $container->setAlias('grumphp.io', 'grumphp.io.console');
     // Make sure to let the logger log to the stdout in verbose mode!
     if ($io->isVerbose()) {
         /** @var Logger $logger */
         $logger = $container->get('grumphp.logger');
         $logger->pushHandler(new StreamHandler('php://stdout', Logger::DEBUG));
     }
 }
Пример #10
0
 /**
  * Configures the input and output instances based on the user arguments and options.
  *
  * @param InputInterface  $input  An InputInterface instance
  * @param OutputInterface $output An OutputInterface instance
  */
 protected function configureIO(InputInterface $input, OutputInterface $output)
 {
     parent::configureIO($input, $output);
     $style = new OutputFormatterStyle();
     $style->setApplication($this);
     $style->setWrap('-', '-');
     $output->getFormatter()->setStyle('h1', $style);
     $style = new OutputFormatterStyle();
     $style->setPaddingOutside(' ===> ');
     $output->getFormatter()->setStyle('h2', $style);
     $style = new OutputFormatterStyle();
     $style->setPaddingOutside('   -  ');
     $output->getFormatter()->setStyle('p', $style);
     $style = new OutputFormatterStyle('white', 'red');
     $style->setPadding(' [EE] ');
     $output->getFormatter()->setStyle('p-error', $style);
 }
Пример #11
0
 /**
  * Configure IO of GrumPHP objects
  *
  * @param InputInterface  $input
  * @param OutputInterface $output
  */
 protected function configureIO(InputInterface $input, OutputInterface $output)
 {
     parent::configureIO($input, $output);
     $container = $this->getContainer();
     // Register the console input and output to the container
     $container->set('console.input', $input);
     $container->set('console.output', $output);
     // Redirect the GrumPHP logger to the stdout in verbose mode
     /** @var IOInterface $io */
     $io = $container->get('grumphp.io.console');
     if ($io->isVerbose()) {
         /** @var Logger $logger */
         $logger = $container->get('grumphp.logger');
         $logger->pushHandler(new StreamHandler('php://stdout', Logger::DEBUG));
     }
 }
Пример #12
0
 /**
  * Override configureIO() so that we can check if the global --no-time-limit option was set.
  *
  * {@inheritDoc}
  */
 protected function configureIO(InputInterface $input, OutputInterface $output)
 {
     if ($input->hasParameterOption("--no-time-limit")) {
         $this->timeLimit = false;
     } else {
         $this->timeLimit = true;
     }
     parent::configureIO($input, $output);
 }
Пример #13
0
 /**
  * @param InputInterface  $input
  * @param OutputInterface $output
  */
 protected function configureIO(InputInterface $input, OutputInterface $output)
 {
     parent::configureIO($input, $output);
     $input->bind(new InputDefinition([new InputArgument('configuration'), new InputArgument('files'), new InputOption('verbose', '-v', InputOption::VALUE_OPTIONAL, '', true)]));
     $input->setArgument('configuration', serialize($this->configuration));
     $input->setArgument('files', serialize($this->files));
 }
Пример #14
0
 /**
  * @param InputInterface  $input
  * @param OutputInterface $output
  */
 public function configureIO(InputInterface $input, OutputInterface $output)
 {
     $this->container['env'] = $input->getParameterOption(array('--env', '-e'), getenv('APP_ENV') ?: 'dev');
     $this->container['debug'] = getenv('APP_DEBUG') !== '0' && !$input->hasParameterOption(array('--no-debug', '')) && $this->container['env'] !== 'prod';
     parent::configureIO($input, $output);
 }
Пример #15
0
 /**
  * {@inheritdoc}
  */
 public function configureIO(InputInterface $input, OutputInterface $output)
 {
     $this->loadConfig($input);
     return parent::configureIO($input, $output);
 }
Пример #16
0
 protected function configureIO(InputInterface $input, OutputInterface $output)
 {
     if ($input->hasParameterOption(['--config', '-c'])) {
         $configPath = realpath($input->getParameterOption(['--config', '-c']));
         if (!$configPath) {
             throw new \InvalidArgumentException(sprintf('Config file does not exists! %s', $configPath));
         }
         $cwd = getcwd();
         chdir(dirname($configPath));
         $yaml = new Parser();
         $config = file_get_contents($configPath);
         $config = $yaml->parse($config);
         array_walk_recursive($config, function (&$item, $key) {
             $item = $this->processPlaceHolder($item);
         });
         $params = isset($config['parameters']) ? $config['parameters'] : [];
         $pipeline = isset($config['pipeline']) ? $config['pipeline'] : [];
         $this->setConfig($params);
         $this->setPipeLine($pipeline);
         chdir($cwd);
     }
     return parent::configureIO($input, $output);
 }
Пример #17
0
 protected function configureIO(InputInterface $input, OutputInterface $output)
 {
     // Set default output verbosity
     $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
     return parent::configureIO($input, $output);
 }