當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。