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


PHP OutputInterface::getErrorOutput方法代码示例

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


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

示例1: execute

 protected function execute(InputInterface $input, OutputInterface $stdout)
 {
     // capture error output
     $stderr = $stdout instanceof ConsoleOutputInterface ? $stdout->getErrorOutput() : $stdout;
     if ($input->getOption('watch')) {
         $stderr->writeln('<error>The --watch option is deprecated. Please use the ' . 'assetic:watch command instead.</error>');
         // build assetic:watch arguments
         $arguments = array('command' => 'assetic:watch', 'write_to' => $this->basePath, '--period' => $input->getOption('period'), '--env' => $input->getOption('env'));
         if ($input->getOption('no-debug')) {
             $arguments['--no-debug'] = true;
         }
         if ($input->getOption('force')) {
             $arguments['--force'] = true;
         }
         $command = $this->getApplication()->find('assetic:watch');
         return $command->run(new ArrayInput($arguments), $stdout);
     }
     // print the header
     $stdout->writeln(sprintf('Dumping all <comment>%s</comment> assets.', $input->getOption('env')));
     $stdout->writeln(sprintf('Debug mode is <comment>%s</comment>.', $this->am->isDebug() ? 'on' : 'off'));
     $stdout->writeln('');
     if ($this->spork) {
         $batch = $this->spork->createBatchJob($this->am->getNames(), new ChunkStrategy($input->getOption('forks')));
         $self = $this;
         $batch->execute(function ($name) use($self, $stdout) {
             $self->dumpAsset($name, $stdout);
         });
     } else {
         foreach ($this->am->getNames() as $name) {
             $this->dumpAsset($name, $stdout);
         }
     }
 }
开发者ID:ccq18,项目名称:EduSoho,代码行数:33,代码来源:DumpCommand.php

示例2: getErrorOutput

 /**
  * @return OutputInterface
  */
 private function getErrorOutput()
 {
     if ($this->output instanceof ConsoleOutputInterface) {
         return $this->output->getErrorOutput();
     }
     return $this->output;
 }
开发者ID:ptondereau,项目名称:laravel-packme,代码行数:10,代码来源:AbstractBaseCommand.php

示例3: notifyFile

 protected function notifyFile(SourceFileInfo $file)
 {
     $output = $this->output instanceof ConsoleOutputInterface ? $this->output->getErrorOutput() : $this->output;
     if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
         $output->writeln("<info>Scanning {$file->getRelativePathname()}</info>");
     }
 }
开发者ID:clockworkgeek,项目名称:magei18n,代码行数:7,代码来源:TreeScanner.php

示例4: log

 /**
  *
  * {@inheritdoc}
  *
  */
 public function log($level, $message, array $context = array())
 {
     if (!isset($this->verbosityLevelMap[$level])) {
         throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level));
     }
     // Write to the error output if necessary and available
     if ($this->formatLevelMap[$level] === self::ERROR && $this->output instanceof ConsoleOutputInterface) {
         $output = $this->output->getErrorOutput();
     } else {
         $output = $this->output;
     }
     if ($output->getVerbosity() >= $this->verbosityLevelMap[$level]) {
         $output->writeln(sprintf('<%1$s>[%2$s] %3$s</%1$s>', $this->formatLevelMap[$level], $level, $this->interpolate($message, $context)));
     }
 }
开发者ID:ngitimfoyo,项目名称:Nyari-AppPHP,代码行数:20,代码来源:ConsoleLogger.php

示例5: createProgressBar

 /**
  * @param int $count
  * @param int $minVerbosity
  *
  * @return ProgressBar
  */
 public function createProgressBar($count, $minVerbosity = OutputInterface::VERBOSITY_NORMAL)
 {
     $stream = new NullOutput();
     if ($this->applicationInput->hasOption('progress') && $this->applicationInput->getOption('progress')) {
         if ($this->applicationOutput instanceof ConsoleOutput) {
             if ($this->applicationOutput->getVerbosity() >= $minVerbosity) {
                 $stream = $this->applicationOutput->getErrorOutput();
             }
         }
     }
     $progress = new ProgressBar($stream, $count);
     // add an additional space, in case logging is also enabled
     $progress->setFormat($progress->getFormatDefinition('normal') . ' ');
     $progress->start();
     return $progress;
 }
开发者ID:digilist,项目名称:snakedumper,代码行数:22,代码来源:ProgressBarHelper.php

示例6: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $error = $output->getErrorOutput();
     $path = $input->getArgument("path");
     $includeRoot = $input->getOption("include-root");
     if (!\file_exists($path)) {
         throw new \Exception("File {$path} doesn't exist");
     }
     try {
         list($inform, $format) = \detectCertFormat($path);
         $cert = \parseFormattedCert(\readCertificate($path, $inform, $format));
     } catch (\Exception $e) {
         $err = implode("\n", $e->output);
         throw new \Exception("Unable to load certificate: {$err}");
     }
     // perform some basic checks
     if (\isExpired($cert)) {
         $error->writeln("Certificate has expired");
     }
     if (\areCertsLinked($cert, $cert)) {
         throw new \Exception("Self-signed or CA cert");
     }
     // this can fail with an exception
     $out = \buildChain($cert, $path, $includeRoot);
     $output->write($out);
 }
开发者ID:pbogdan,项目名称:cert-utils,代码行数:26,代码来源:BuildChainCommand.php

示例7: initialize

 /**
  * @inheritdoc
  */
 protected function initialize(InputInterface $input, OutputInterface $output)
 {
     $this->stdOut = $output;
     $this->stdErr = $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output;
     $this->stdIn = $input;
     self::$interactive = $input->isInteractive();
 }
开发者ID:mglaman,项目名称:platform-docker,代码行数:10,代码来源:ProviderCommand.php

示例8: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     # If possible log to stderr because stdout receives the dot file
     $logger = new SymfonyConsoleOutput($output instanceof ConsoleOutput ? $output->getErrorOutput() : $output);
     $project = new Project($logger);
     if ($input->getOption('quiet')) {
         $logger->setReportingLevel(Logger::ERROR);
     } else {
         if ($input->getOption('verbose')) {
             $logger->setReportingLevel(Logger::INFO);
         }
     }
     SourceHandler::addSourcesToProject($input, $project);
     # Necessary setup to generate the objectGraph
     $project->addAnalyzer(new Parser(new \PhpParser\Parser(new Lexer())));
     $project->addAnalyzer(new NameResolver());
     $project->addAnalyzer($objectGraph = new ObjectGraph());
     $project->analyze();
     $graphviz = new GraphvizConverter();
     $graphviz->setGraph($objectGraph);
     # Console configuration
     $graphviz->setNamespaceWhitelist($input->getOption('namespaces'));
     $graphviz->setShowNamespace($input->getOption('show-namespace'));
     $graphviz->setShowOnlyConnected($input->getOption('show-only-connected'));
     $graphviz->setClusterByNamespace($input->getOption('cluster-namespaces'));
     $graphviz->setNestClusters($input->getOption('nest-clusters'));
     $output->write($graphviz->generate());
 }
开发者ID:mfn,项目名称:php-analyzer,代码行数:28,代码来源:Graphviz.php

示例9: getOutput

 /**
  * {@inheritdoc}
  */
 public function getOutput($level = LogLevel::NOTICE)
 {
     $output = $this->output;
     if ($this->output instanceof ConsoleOutputInterface && in_array($level, array(LogLevel::EMERGENCY, LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::ERROR))) {
         $output = $this->output->getErrorOutput();
     }
     return $output;
 }
开发者ID:deborahvandervegt,项目名称:accompli,代码行数:11,代码来源:ConsoleLogger.php

示例10: error_log

 private function error_log($errorString)
 {
     if ($this->output instanceof ConsoleOutputInterface) {
         $this->output->getErrorOutput()->writeln($errorString);
     } else {
         error_log($errorString);
     }
 }
开发者ID:lgnap,项目名称:ansible-tags-parser,代码行数:8,代码来源:YamlParser.php

示例11: write

 /**
  * {@inheritdoc}
  */
 protected function write(array $record)
 {
     if ($record['level'] >= Logger::ERROR && $this->output instanceof ConsoleOutputInterface) {
         $this->output->getErrorOutput()->write((string) $record['formatted']);
     } else {
         $this->output->write((string) $record['formatted']);
     }
 }
开发者ID:NivalM,项目名称:VacantesJannaMotors,代码行数:11,代码来源:ConsoleHandler.php

示例12: doWrite

 /**
  * @param array $messages
  * @param bool  $newline
  * @param bool  $stderr
  */
 private function doWrite($messages, $newline, $stderr)
 {
     if (true === $stderr && $this->output instanceof ConsoleOutputInterface) {
         $this->output->getErrorOutput()->write($messages, $newline);
         return;
     }
     $this->output->write($messages, $newline);
 }
开发者ID:llaville,项目名称:grumphp,代码行数:13,代码来源:ConsoleIO.php

示例13: initialize

 /**
  * @inheritdoc
  */
 protected function initialize(InputInterface $input, OutputInterface $output)
 {
     $this->stdOut = $output;
     $this->stdErr = $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output;
     $this->stdIn = $input;
     self::$interactive = $input->isInteractive();
     // Check if this command requires a project to be defined in order to run.
     $this->checkProjectRequired();
 }
开发者ID:mglaman,项目名称:platform-docker,代码行数:12,代码来源:Command.php

示例14: execute

    public function execute(InputInterface $input, OutputInterface $output)
    {
        $stderr = $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output;
        include_once $input->getArgument('input');
        $config = array();
        // 1. One-to-one maps
        foreach ($this->option_map as $old => $new) {
            if (defined($old)) {
                $config[$new] = constant($old);
            }
        }
        // 2. Special processing
        if (defined('SIMPLEID_CLEAN_URL') && !constant('SIMPLEID_CLEAN_URL')) {
            $stderr->writeln('<error>SIMPLEID_CLEAN_URL is set to false. This is not supported by SimpleID 2.</error>');
        }
        if (defined('SIMPLEID_STORE') && constant('SIMPLEID_STORE') != 'filesystem') {
            $stderr->writeln('<error>Warning: Custom SIMPLEID_STORE.  This will need to be migrated manually.</error>');
        }
        if (defined('SIMPLEID_CACHE_DIR')) {
            $config['cache'] = 'folder=' . constant('SIMPLEID_CACHE_DIR');
        }
        if (defined('SIMPLEID_LOGLEVEL')) {
            $config['log_level'] = $this->log_level_map[constant('SIMPLEID_LOGLEVEL')];
        }
        // 3. Add required configuration
        $config = array_merge($config, $this->additional_config);
        // 4. Results.
        $results = <<<_END_HEADER_
<?php
#
# SimpleID configuration file.
#
# ** Generated by SimpleIDTool **
#
# ** Review this file against config.php.dist and make additional manual
# changes **
#
# By default, the SimpleID configuration is formatted as YAML.  However
# you can insert PHP code after the YAML section for further configuration.
#
{$config} = Spyc::YAMLLoadString(<<<_END_YAML_

_END_HEADER_;
        $results .= Spyc::YAMLDump($config, 4, false, true);
        $results .= <<<_END_FOOTER_
_END_YAML_
);

?>
_END_FOOTER_;
        if ($input->getArgument('output')) {
            file_put_contents($input->getArgument('output', $results));
        } else {
            $output->writeln($results);
        }
    }
开发者ID:markwu,项目名称:simpleid,代码行数:56,代码来源:MigrateConfigCommand.php

示例15: initialize

 /**
  * @inheritdoc
  */
 protected function initialize(InputInterface $input, OutputInterface $output)
 {
     $this->stdOut = $output;
     $this->stdErr = $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output;
     $this->stdIn = $input;
     self::$interactive = $input->isInteractive();
     if (empty(Config::get())) {
         $this->getApplication()->find('init')->run($input, $output);
         exit(1);
     }
 }
开发者ID:pjcdawkins,项目名称:platform-docker,代码行数:14,代码来源:Command.php


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