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


PHP SymfonyStyle::getVerbosity方法代码示例

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


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

示例1: execCmd

 /**
  * @param string $cmd
  * @param bool   $ignoreErrors
  *
  * @throws Exception
  */
 private function execCmd($cmd, $ignoreErrors = false)
 {
     $cmd = 'cd ' . $this->workspacePath . ' && ' . $cmd;
     if ($this->io->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
         $this->io->comment($cmd);
     }
     $process = new Process($cmd);
     $process->run(function ($type, $buffer) use($ignoreErrors) {
         if (Process::ERR === $type) {
             if ($ignoreErrors) {
                 if ($this->io->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
                     $this->io->comment($buffer);
                 }
             } else {
                 $this->io->error($buffer);
             }
         } else {
             if ($this->io->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
                 $this->io->comment($buffer);
             }
         }
     });
     if (!$ignoreErrors && !$process->isSuccessful()) {
         throw new Exception($process->getOutput() . $process->getErrorOutput());
     }
 }
开发者ID:lucascherifi,项目名称:gitaski,代码行数:32,代码来源:GitProcessor.php

示例2: execute

 /**
  * Execute a bash command.
  *
  * @param array $command
  * @param bool  $showOutput
  *
  * @return string
  */
 protected function execute(array $command, $showOutput = true)
 {
     $helper = new ProcessHelper();
     $helper->setHelperSet(new HelperSet(['debug_formatter' => new DebugFormatterHelper()]));
     // Compute new verbosity
     $previousVerbosity = $this->output->getVerbosity();
     $verbosity = $showOutput ? OutputInterface::VERBOSITY_DEBUG : OutputInterface::VERBOSITY_QUIET;
     // Execute command with defined verbosity
     $this->output->setVerbosity($verbosity);
     $process = $helper->run($this->output, $command);
     $this->output->setVerbosity($previousVerbosity);
     return $process->getOutput();
 }
开发者ID:Anahkiasen,项目名称:versioner,代码行数:21,代码来源:Versioner.php

示例3: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->io = new SymfonyStyle($input, $output);
     $this->io->block('Running server...');
     $verbosity = $this->io->getVerbosity();
     switch ($verbosity) {
         case 16:
             $verbosity = 'quiet';
             break;
         case 32:
             $verbosity = 'normal';
             break;
         case 64:
             $verbosity = 'verbose';
             break;
         case 128:
             $verbosity = 'very_verbose';
             break;
         case 256:
             $verbosity = 'debug';
             break;
     }
     $this->io->note('Verbosity is "' . $verbosity . '". To set verbosity, add "-v", "-vv" or "-vvv" end the end of this command.');
     $this->socketPort = $this->getContainer()->getParameter('socket_port');
     $em = $this->getContainer()->get('doctrine.orm.default_entity_manager');
     $logger = $this->getContainer()->get('logger');
     $socketUrl = $this->getContainer()->getParameter('socket_server_url');
     $webUrl = $this->getContainer()->getParameter('web_server_url');
     $webHooks = $em->getRepository('AppBundle:WebHook')->findAll();
     $logger->info(count($webHooks) . ' webHook(s)');
     $server = new Server($em, $webHooks, $webUrl, $socketUrl, $logger);
     $this->killExistingSocketServer();
     $ioServer = IoServer::factory(new HttpServer(new WsServer($server)), $this->socketPort);
     $logger->info('Run socket server on port ' . $this->socketPort . '...');
     $ioServer->run();
 }
开发者ID:localhook,项目名称:localhook-server,代码行数:36,代码来源:RunSocketCommand.php

示例4: createServerProcess

 /**
  * @param SymfonyStyle $io
  * @param string       $address
  * @param string       $webDir
  * @param string       $router
  *
  * @return null|\Symfony\Component\Process\Process
  */
 protected function createServerProcess(SymfonyStyle $io, $address, $webDir, $router)
 {
     if (!file_exists($router)) {
         $io->error(sprintf('The router script "%s" does not exist', $router));
         return null;
     }
     $finder = new PhpExecutableFinder();
     if (($binary = $finder->find()) === false) {
         $io->error('Unable to find PHP binary to run server.');
         return null;
     }
     $builder = new ProcessBuilder([$binary, '-S', $address, '-t', $webDir, $router]);
     $builder->setTimeout(null);
     if ($io->getVerbosity() < OutputInterface::VERBOSITY_VERBOSE) {
         $builder->disableOutput();
     }
     return $builder->getProcess();
 }
开发者ID:robbert-vdh,项目名称:bolt,代码行数:26,代码来源:ServerRun.php

示例5: verboseLog

 /**
  * @param string $msg
  * @param        $color
  */
 protected function verboseLog($msg, $color)
 {
     if ($this->io && $this->io->getVerbosity() === OutputInterface::VERBOSITY_DEBUG) {
         $this->io->comment('<' . $color . '>' . date('[Y-m-d H:i:s]') . $msg . '</' . $color . '>');
     }
 }
开发者ID:localhook,项目名称:localhook,代码行数:10,代码来源:AbstractClient.php


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