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


PHP StreamOutput::setVerbosity方法代码示例

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


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

 /**
  * @param string $input
  * @param array  $options
  *
  * @return integer
  */
 public function run($input, array $options = array())
 {
     if (isset($options['interactive']) && $options['interactive']) {
         $this->input = new InteractiveStringInput($input);
     } else {
         $this->input = new StringInput($input);
         $this->input->setInteractive(false);
     }
     $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']);
     }
     $inputStream = $this->getInputStream();
     rewind($inputStream);
     $this->application->getHelperSet()->get('dialog')->setInputStream($inputStream);
     return $this->application->run($this->input, $this->output);
 }
开发者ID:burimshala,项目名称:numbertowords,代码行数:26,代码来源:ApplicationTester.php

示例3: runCommand

    /**
     * Runs a command and returns it output.
     *
     * @param Client $client
     * @param string $command
     * @param int    $verbosity Verbosity level to use.
     * @param int    $exitCode  Expected command exit code.
     *
     * @return string
     */
    protected function runCommand(Client $client, $command, $verbosity = OutputInterface::VERBOSITY_NORMAL, $exitCode = 0)
    {
        $application = new Application($client->getKernel());
        $application->setAutoExit(false);

        $fp = tmpfile();
        $input = new StringInput($command);
        $output = new StreamOutput($fp);
        $output->setVerbosity($verbosity);

        $realCode = $application->run($input, $output);

        fseek($fp, 0);
        $output = '';
        while (!feof($fp)) {
            $output = fread($fp, 4096);
        }
        fclose($fp);

        $this->assertEquals($exitCode, $realCode, $output);

        return $output;
    }
开发者ID:ataxel,项目名称:tp,代码行数:33,代码来源:CommandTestCase.php

示例4: configureOutputConsole

 /**
  * Configure output console parameters.
  *
  * @param StreamOutput $console
  */
 protected function configureOutputConsole(StreamOutput $console)
 {
     $console->setVerbosity($this->parameters->get('verbose') ? StreamOutput::VERBOSITY_VERBOSE : StreamOutput::VERBOSITY_NORMAL);
     $console->getFormatter()->setDecorated($this->parameters->get('decorated'));
 }
开发者ID:unkerror,项目名称:Budabot,代码行数:10,代码来源:ConsoleFormatter.php

示例5: setVerbosity

 /**
  * {@inheritdoc}
  */
 public function setVerbosity($level)
 {
     parent::setVerbosity($level);
     $this->stderr->setVerbosity($level);
 }
开发者ID:betes-curieuses-design,项目名称:ElieJosiePhotographie,代码行数:8,代码来源:ConsoleOutput.php

示例6: configureOutputConsole

 /**
  * Configure output console parameters.
  *
  * @param StreamOutput $console
  */
 protected function configureOutputConsole(StreamOutput $console)
 {
     $verbosity = $this->verbosityLevel ? StreamOutput::VERBOSITY_VERBOSE : StreamOutput::VERBOSITY_NORMAL;
     $console->setVerbosity($verbosity);
     if (null !== $this->outputDecorated) {
         $console->getFormatter()->setDecorated($this->outputDecorated);
     }
 }
开发者ID:SimonPotthast,项目名称:jenkins-test,代码行数:13,代码来源:ConsoleOutputPrinter.php


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