当前位置: 首页>>代码示例>>PHP>>正文


PHP OutputInterface::setVerbosity方法代码示例

本文整理汇总了PHP中Symfony\Component\Console\Output\OutputInterface::setVerbosity方法的典型用法代码示例。如果您正苦于以下问题:PHP OutputInterface::setVerbosity方法的具体用法?PHP OutputInterface::setVerbosity怎么用?PHP OutputInterface::setVerbosity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Console\Output\OutputInterface的用法示例。


在下文中一共展示了OutputInterface::setVerbosity方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 /**
  * Executes the application.
  *
  * Available options:
  *
  *  * interactive:               Sets the input interactive flag
  *  * decorated:                 Sets the output decorated flag
  *  * verbosity:                 Sets the output verbosity flag
  *  * capture_stderr_separately: Make output of stdOut and stdErr separately available
  *
  * @param array $input   An array of arguments and options
  * @param array $options An array of options
  *
  * @return int The command exit code
  */
 public function run(array $input, $options = array())
 {
     $this->input = new ArrayInput($input);
     if (isset($options['interactive'])) {
         $this->input->setInteractive($options['interactive']);
     }
     $this->captureStreamsIndependently = array_key_exists('capture_stderr_separately', $options) && $options['capture_stderr_separately'];
     if (!$this->captureStreamsIndependently) {
         $this->output = new StreamOutput(fopen('php://memory', 'w', false));
         if (isset($options['decorated'])) {
             $this->output->setDecorated($options['decorated']);
         }
         if (isset($options['verbosity'])) {
             $this->output->setVerbosity($options['verbosity']);
         }
     } else {
         $this->output = new ConsoleOutput(isset($options['verbosity']) ? $options['verbosity'] : ConsoleOutput::VERBOSITY_NORMAL, isset($options['decorated']) ? $options['decorated'] : null);
         $errorOutput = new StreamOutput(fopen('php://memory', 'w', false));
         $errorOutput->setFormatter($this->output->getFormatter());
         $errorOutput->setVerbosity($this->output->getVerbosity());
         $errorOutput->setDecorated($this->output->isDecorated());
         $reflectedOutput = new \ReflectionObject($this->output);
         $strErrProperty = $reflectedOutput->getProperty('stderr');
         $strErrProperty->setAccessible(true);
         $strErrProperty->setValue($this->output, $errorOutput);
         $reflectedParent = $reflectedOutput->getParentClass();
         $streamProperty = $reflectedParent->getProperty('stream');
         $streamProperty->setAccessible(true);
         $streamProperty->setValue($this->output, fopen('php://memory', 'w', false));
     }
     return $this->statusCode = $this->application->run($this->input, $this->output);
 }
开发者ID:Ener-Getick,项目名称:symfony,代码行数:47,代码来源:ApplicationTester.php

示例2: doRun

 /**
  * Runs the current application.
  *
  * @param InputInterface  $input  An Input instance
  * @param OutputInterface $output An Output instance
  *
  * @return integer 0 if everything went fine, or an error code
  */
 public function doRun(InputInterface $input, OutputInterface $output)
 {
     $output->writeLn($this->getHeader());
     $name = $this->getCommandName($input);
     if (true === $input->hasParameterOption(array('--shell', '-s'))) {
         $shell = new Shell($this);
         $shell->run();
         return 0;
     }
     if (true === $input->hasParameterOption(array('--ansi'))) {
         $output->setDecorated(true);
     } elseif (true === $input->hasParameterOption(array('--no-ansi'))) {
         $output->setDecorated(false);
     }
     if (true === $input->hasParameterOption(array('--help', '-h'))) {
         if (!$name) {
             $name = 'help';
             $input = new ArrayInput(array('command' => 'help'));
         } else {
             $this->wantHelps = true;
         }
     }
     if (true === $input->hasParameterOption(array('--no-interaction', '-n'))) {
         $input->setInteractive(false);
     }
     if (function_exists('posix_isatty') && $this->getHelperSet()->has('dialog')) {
         $inputStream = $this->getHelperSet()->get('dialog')->getInputStream();
         if (!posix_isatty($inputStream)) {
             $input->setInteractive(false);
         }
     }
     if (true === $input->hasParameterOption(array('--quiet', '-q'))) {
         $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
     } elseif (true === $input->hasParameterOption(array('--verbose', '-v'))) {
         $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
     }
     if (true === $input->hasParameterOption(array('--version', '-V'))) {
         $output->writeln($this->getLongVersion());
         return 0;
     }
     if (!$name) {
         $name = 'list';
         $input = new ArrayInput(array('command' => 'list'));
     }
     // the command name MUST be the first element of the input
     $command = $this->find($name);
     $this->runningCommand = $command;
     $statusCode = $command->run($input, $output);
     $this->runningCommand = null;
     # write Footer
     $output->writeLn($this->getFooter());
     return is_numeric($statusCode) ? $statusCode : 0;
 }
开发者ID:icomefromthenet,项目名称:faker,代码行数:61,代码来源:Application.php

示例3: setupOutput

 protected function setupOutput()
 {
     $outputResource = $this->getLogsResource();
     $this->output = new StreamOutput($outputResource);
     $this->output->setDecorated(false);
     $this->output->setVerbosity(true);
 }
开发者ID:WeavingTheWeb,项目名称:devobs,代码行数:7,代码来源:ModerateIndexPopulationCommand.php

示例4: execute

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $composer = $this->getComposer();
        $binDir = $composer->getConfig()->get('bin-dir');
        if ($input->getOption('list') || !$input->getArgument('binary')) {
            $bins = glob($binDir . '/*');
            if (!$bins) {
                throw new \RuntimeException("No binaries found in bin-dir ({$binDir})");
            }
            $this->getIO()->write(<<<EOT
<comment>Available binaries:</comment>
EOT
);
            foreach ($bins as $bin) {
                // skip .bat copies
                if (isset($previousBin) && $bin === $previousBin . '.bat') {
                    continue;
                }
                $previousBin = $bin;
                $bin = basename($bin);
                $this->getIO()->write(<<<EOT
<info>- {$bin}</info>
EOT
);
            }
            return;
        }
        $binary = $input->getArgument('binary');
        $dispatcher = $composer->getEventDispatcher();
        $dispatcher->addListener('__exec_command', $binary);
        if ($output->getVerbosity() === OutputInterface::VERBOSITY_NORMAL) {
            $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
        }
        return $dispatcher->dispatchScript('__exec_command', true, $input->getArgument('args'));
    }
开发者ID:Doability,项目名称:magento2dev,代码行数:35,代码来源:ExecCommand.php

示例5: execute

 /**
  * @param InputInterface  $input
  * @param OutputInterface $output
  *
  * @return integer
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->typeCheck->execute(func_get_args());
     $this->isolator->chdir($input->getArgument('path'));
     $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
     $configuration = $this->getApplication()->configurationReader()->read(null, true);
     $this->includeLoaders($configuration, $output);
     $output->writeln('<info>Checking for correct Typhoon setup...</info>');
     $result = $this->analyzer()->analyze($configuration);
     if (count($result->issues()) < 1) {
         $output->writeln('<info>No problems detected.</info>');
     } else {
         if (count($result->issuesBySeverity(IssueSeverity::ERROR())) > 0) {
             $output->writeln('');
             $output->writeln($this->generateErrorBlock($result));
         }
         if (count($result->issuesBySeverity(IssueSeverity::WARNING())) > 0) {
             $output->writeln('');
             $output->writeln($this->generateWarningBlock($result));
         }
     }
     if ($result->isError()) {
         return 1;
     }
     return 0;
 }
开发者ID:eloquent,项目名称:typhoon,代码行数:32,代码来源:CheckCommand.php

示例6: getLogger

 /**
  * @param OutputInterface $output
  * @return OutputLogger
  */
 protected function getLogger(OutputInterface $output)
 {
     if ($output->getVerbosity() < OutputInterface::VERBOSITY_VERBOSE) {
         $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
     }
     return new OutputLogger($output);
 }
开发者ID:antrampa,项目名称:crm,代码行数:11,代码来源:InitialSyncCommand.php

示例7: execute

 /**
  * {@inheritdoc}
  *
  * @see PlatformCommand::getCurrentEnvironment()
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     /** @var \Symfony\Component\Console\Helper\ProcessHelper $process */
     $process = $this->getHelper('process');
     $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
     if (!is_dir(Platform::rootDir() . '/docker/fg')) {
         $process->mustRun($output, ['git', 'clone', 'https://github.com/brendangregg/FlameGraph.git', Platform::rootDir() . '/docker/fg']);
     }
     if (!is_dir(Platform::rootDir() . '/docker/xhpfg')) {
         $process->mustRun($output, ['git', 'clone', 'https://github.com/msonnabaum/xhprof-flamegraphs.git', Platform::rootDir() . '/docker/xhpfg']);
     }
     $stack = StacksFactory::getStack(Platform::webDir());
     switch ($stack->type()) {
         case Stacks\Drupal::TYPE:
             $this->stdOut->writeln("<comment>Patching Drupal for xhprof</comment>");
             $patchProcess = new Process('patch -p1 < ' . CLI_ROOT . '/resources/drupal-enable-profiling.patch', Platform::webDir());
             break;
         case Stacks\WordPress::TYPE:
             $this->stdOut->writeln("<comment>Patching WordPress for xhprof</comment>");
             $patchProcess = new Process('patch -p0 < ' . CLI_ROOT . '/resources/wordpress-enable-profiling.patch', Platform::webDir());
             break;
         default:
             throw new \Exception('Stack type not supported yet.');
     }
     $patchProcess->mustRun();
 }
开发者ID:mglaman,项目名称:platform-docker,代码行数:31,代码来源:SetupCommand.php

示例8: configureOutputStream

 /**
  * Configure output stream parameters.
  *
  * @param OutputInterface $output
  */
 protected function configureOutputStream(OutputInterface $output)
 {
     $verbosity = $this->getOutputVerbosity() ? OutputInterface::VERBOSITY_VERBOSE : OutputInterface::VERBOSITY_NORMAL;
     $output->setVerbosity($verbosity);
     if (null !== $this->isOutputDecorated()) {
         $output->getFormatter()->setDecorated($this->isOutputDecorated());
     }
 }
开发者ID:OverByThere,项目名称:Behat,代码行数:13,代码来源:ConsoleOutputFactory.php

示例9: doCommand

 protected function doCommand(OutputInterface $output, $verbosity, $command, $args)
 {
     $oldVerbosity = $output->getVerbosity();
     $output->setVerbosity($verbosity);
     $c = $this->getApplication()->find($command);
     $input = new \Symfony\Component\Console\Input\ArrayInput(array_merge(array('command' => $c), $args));
     $c->run($input, $output);
     $output->setVerbosity($oldVerbosity);
 }
开发者ID:eileenmcnaughton,项目名称:amp,代码行数:9,代码来源:ContainerAwareCommand.php

示例10: doRun

 public function doRun(InputInterface $input, OutputInterface $output)
 {
     // introspect input without definition
     $config = $input->getParameterOption(array('--config', '-c'));
     $verbose = $input->getParameterOption(array('--verbose', '-v'));
     $bootstrap = $input->getParameterOption(array('--bootstrap', '-b'));
     $profile = $input->getParameterOption(array('--profile', '-p'));
     if (true == $verbose) {
         $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
     }
     $container = $this->getContainer();
     // event dispatcher
     $container['dispatcher'] = new EventDispatcher();
     $container['input'] = $input;
     $container['output'] = $output;
     // config
     /**
      * Process options
      */
     $this->register(new ConfigServiceProvider(), array('config.path' => $config));
     if ($profile) {
         $container['config.profile'] = $profile;
     }
     $overrides = array();
     if ($input->hasParameterOption(array('--verbose', '-v'))) {
         $overrides['verbose'] = true;
     }
     if ($bootstrap) {
         $overrides['bootstrap'] = $bootstrap;
     }
     $container['config.overrides'] = $overrides;
     /**
      * Should overwrite the profile with command line options here
      */
     $profile = $container['profile'];
     if ($profile->bootstrap) {
         $inc = function () use($profile) {
             require $profile->bootstrap;
         };
         $inc();
     }
     // extensions
     foreach ($profile->extensions as $name => $options) {
         $class = "\\DSpec\\Provider\\" . ucfirst($name) . "ServiceProvider";
         if (!class_exists($class)) {
             $class = $name;
             if (!class_exists($class)) {
                 throw new \InvalidArgumentException("class:{$class} not found");
             }
         }
         $this->register(new $class(), (array) $options);
     }
     $container['dspec.command'] = new DSpecCommand($container);
     $this->bootProviders();
     $this->add($container['dspec.command']);
     return parent::doRun($input, $output);
 }
开发者ID:churchcommunitybuilder,项目名称:dspec,代码行数:57,代码来源:DSpecApplication.php

示例11: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->isVerbose = OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity();
     if (!$this->isVerbose && $this->config->verboseMode) {
         $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
         $this->isVerbose = true;
     }
     $this->output = $output;
 }
开发者ID:mdouchin,项目名称:jelix,代码行数:9,代码来源:AbstractCommand.php

示例12: execute

 /**
  * @param InputInterface  $input
  * @param OutputInterface $output
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->typeCheck->execute(func_get_args());
     $this->isolator->chdir($input->getArgument('path'));
     $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
     $configuration = $this->getApplication()->configurationReader()->read(null, true);
     $this->includeLoaders($configuration, $output);
     $output->writeln('<info>Generating classes...</info>');
     $this->generator()->generate($configuration);
     $output->writeln('<info>Done.</info>');
 }
开发者ID:eloquent,项目名称:typhoon,代码行数:15,代码来源:GenerateCommand.php

示例13: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (!empty($input->getOption('debug')) && $output->getVerbosity() < OutputInterface::VERBOSITY_VERBOSE) {
         $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
     }
     $output->writeln($this->getApplication()->getLongVersion() . "\n", Output::VERBOSITY_VERBOSE);
     $formatter = KeyLighter::get()->getFormatter($input->getOption('format')) ?: KeyLighter::get()->getDefaultFormatter();
     foreach ($input->getArgument('path') as $filename) {
         $this->process($input, $output, $filename, $formatter);
     }
 }
开发者ID:kadet1090,项目名称:KeyLighter,代码行数:11,代码来源:HighlightCommand.php

示例14: execute

 public function execute(InputInterface $input, OutputInterface $output)
 {
     $output->writeln(\Codeception\Codecept::versionString() . "\nPowered by " . \PHPUnit_Runner_Version::getVersionString());
     $options = $input->getOptions();
     if ($options['debug']) {
         $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
     }
     $options['verbosity'] = $output->getVerbosity();
     if (!extension_loaded('curl')) {
         throw new \Exception("Codeception requires CURL extension installed to make tests run\n" . "If you are not sure, how to install CURL, pls refer to StackOverflow\n\n" . "Notice: PHP for Apache/Nginx and CLI can have different php.ini files.\n" . "Please make sure that your PHP you run from console has CURL enabled.");
     }
     $config = Configuration::config($options['config']);
     $suite = $input->getArgument('suite');
     $test = $input->getArgument('test');
     if (!Configuration::isEmpty() && !$test && strpos($suite, $config['paths']['tests']) === 0) {
         list($matches, $suite, $test) = $this->matchTestFromFilename($suite, $config['paths']['tests']);
     }
     if ($options['group']) {
         $output->writeln(sprintf("[Groups] <info>%s</info> ", implode(', ', $options['group'])));
     }
     if ($input->getArgument('test')) {
         $options['steps'] = true;
     }
     if ($test) {
         $filter = $this->matchFilteredTestName($test);
         $options['filter'] = $filter;
     }
     $this->codecept = new \Codeception\Codecept((array) $options);
     if ($suite and $test) {
         $this->codecept->run($suite, $test);
     }
     if (!$test) {
         $suites = $suite ? explode(',', $suite) : Configuration::suites();
         $current_dir = Configuration::projectDir();
         $executed = $this->runSuites($suites, $options['skip']);
         foreach ($config['include'] as $included_config_file) {
             Configuration::config($full_path = $current_dir . $included_config_file);
             $namespace = $this->currentNamespace();
             $output->writeln("\n<fg=white;bg=magenta>\n[{$namespace}]: tests from {$full_path}\n</fg=white;bg=magenta>");
             $suites = $suite ? explode(',', $suite) : Configuration::suites();
             $executed += $this->runSuites($suites, $options['skip']);
         }
         if (!$executed) {
             throw new \RuntimeException(sprintf("Suite '%s' could not be found", implode(', ', $suites)));
         }
     }
     $this->codecept->printResult();
     if (!$input->getOption('no-exit')) {
         if ($this->codecept->getResult()->failureCount() or $this->codecept->getResult()->errorCount()) {
             exit(1);
         }
     }
 }
开发者ID:lenninsanchez,项目名称:donadores,代码行数:53,代码来源:Run.php

示例15: loadCommands

 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @throws \Exception
  */
 public function loadCommands(InputInterface $input, OutputInterface $output)
 {
     // $application is required to be defined in the register_command scripts
     $application = $this->application;
     $inputDefinition = $application->getDefinition();
     $inputDefinition->addOption(new InputOption('no-warnings', null, InputOption::VALUE_NONE, 'Skip global warnings, show command output only', null));
     try {
         $input->bind($inputDefinition);
     } catch (\RuntimeException $e) {
         //expected if there are extra options
     }
     if ($input->getOption('no-warnings')) {
         $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
     }
     require_once __DIR__ . '/../../../core/register_command.php';
     if ($this->config->getSystemValue('installed', false)) {
         if (\OCP\Util::needUpgrade()) {
             $output->writeln("ownCloud or one of the apps require upgrade - only a limited number of commands are available");
             $output->writeln("You may use your browser or the occ upgrade command to do the upgrade");
         } elseif ($this->config->getSystemValue('maintenance', false)) {
             $output->writeln("ownCloud is in maintenance mode - no app have been loaded");
         } else {
             OC_App::loadApps();
             foreach (\OC::$server->getAppManager()->getInstalledApps() as $app) {
                 $appPath = \OC_App::getAppPath($app);
                 if ($appPath === false) {
                     continue;
                 }
                 \OC::$loader->addValidRoot($appPath);
                 $file = $appPath . '/appinfo/register_command.php';
                 if (file_exists($file)) {
                     require $file;
                 }
             }
         }
     } else {
         $output->writeln("ownCloud is not installed - only a limited number of commands are available");
     }
     $input = new ArgvInput();
     if ($input->getFirstArgument() !== 'check') {
         $errors = \OC_Util::checkServer(\OC::$server->getConfig());
         if (!empty($errors)) {
             foreach ($errors as $error) {
                 $output->writeln((string) $error['error']);
                 $output->writeln((string) $error['hint']);
                 $output->writeln('');
             }
             throw new \Exception("Environment not properly prepared.");
         }
     }
 }
开发者ID:stweil,项目名称:owncloud-core,代码行数:56,代码来源:Application.php


注:本文中的Symfony\Component\Console\Output\OutputInterface::setVerbosity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。