Verzeichnisstruktur phpBB-3.1.0
- Veröffentlicht
- 27.10.2014
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
ConsoleOutput.php
001 <?php
002
003 /*
004 * This file is part of the Symfony package.
005 *
006 * (c) Fabien Potencier <fabien@symfony.com>
007 *
008 * For the full copyright and license information, please view the LICENSE
009 * file that was distributed with this source code.
010 */
011
012 namespace Symfony\Component\Console\Output;
013
014 use Symfony\Component\Console\Formatter\OutputFormatterInterface;
015
016 /**
017 * ConsoleOutput is the default class for all CLI output. It uses STDOUT.
018 *
019 * This class is a convenient wrapper around `StreamOutput`.
020 *
021 * $output = new ConsoleOutput();
022 *
023 * This is equivalent to:
024 *
025 * $output = new StreamOutput(fopen('php://stdout', 'w'));
026 *
027 * @author Fabien Potencier <fabien@symfony.com>
028 *
029 * @api
030 */
031 class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
032 {
033 private $stderr;
034
035 /**
036 * Constructor.
037 *
038 * @param int $verbosity The verbosity level (one of the VERBOSITY constants in OutputInterface)
039 * @param bool|null $decorated Whether to decorate messages (null for auto-guessing)
040 * @param OutputFormatterInterface|null $formatter Output formatter instance (null to use default OutputFormatter)
041 *
042 * @api
043 */
044 public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
045 {
046 $outputStream = 'php://stdout';
047 if (!$this->hasStdoutSupport()) {
048 $outputStream = 'php://output';
049 }
050
051 parent::__construct(fopen($outputStream, 'w'), $verbosity, $decorated, $formatter);
052
053 $this->stderr = new StreamOutput(fopen('php://stderr', 'w'), $verbosity, $decorated, $this->getFormatter());
054 }
055
056 /**
057 * {@inheritdoc}
058 */
059 public function setDecorated($decorated)
060 {
061 parent::setDecorated($decorated);
062 $this->stderr->setDecorated($decorated);
063 }
064
065 /**
066 * {@inheritdoc}
067 */
068 public function setFormatter(OutputFormatterInterface $formatter)
069 {
070 parent::setFormatter($formatter);
071 $this->stderr->setFormatter($formatter);
072 }
073
074 /**
075 * {@inheritdoc}
076 */
077 public function setVerbosity($level)
078 {
079 parent::setVerbosity($level);
080 $this->stderr->setVerbosity($level);
081 }
082
083 /**
084 * {@inheritdoc}
085 */
086 public function getErrorOutput()
087 {
088 return $this->stderr;
089 }
090
091 /**
092 * {@inheritdoc}
093 */
094 public function setErrorOutput(OutputInterface $error)
095 {
096 $this->stderr = $error;
097 }
098
099 /**
100 * Returns true if current environment supports writing console output to
101 * STDOUT.
102 *
103 * IBM iSeries (OS400) exhibits character-encoding issues when writing to
104 * STDOUT and doesn't properly convert ASCII to EBCDIC, resulting in garbage
105 * output.
106 *
107 * @return bool
108 */
109 protected function hasStdoutSupport()
110 {
111 return ('OS400' != php_uname('s'));
112 }
113 }
114