BufferedOutput.php
2 years ago
ConsoleOutput.php
2 years ago
ConsoleOutputInterface.php
2 years ago
ConsoleSectionOutput.php
2 years ago
NullOutput.php
2 years ago
Output.php
2 years ago
OutputInterface.php
2 years ago
StreamOutput.php
2 years ago
TrimmedBufferOutput.php
2 years ago
BufferedOutput.php
42 lines
| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | * This file is part of the Symfony package. |
| 5 | * |
| 6 | * (c) Fabien Potencier <fabien@symfony.com> |
| 7 | * |
| 8 | * For the full copyright and license information, please view the LICENSE |
| 9 | * file that was distributed with this source code. |
| 10 | */ |
| 11 | namespace IAWP_SCOPED\Symfony\Component\Console\Output; |
| 12 | |
| 13 | /** |
| 14 | * @author Jean-François Simon <contact@jfsimon.fr> |
| 15 | * @internal |
| 16 | */ |
| 17 | class BufferedOutput extends Output |
| 18 | { |
| 19 | private $buffer = ''; |
| 20 | /** |
| 21 | * Empties buffer and returns its content. |
| 22 | * |
| 23 | * @return string |
| 24 | */ |
| 25 | public function fetch() |
| 26 | { |
| 27 | $content = $this->buffer; |
| 28 | $this->buffer = ''; |
| 29 | return $content; |
| 30 | } |
| 31 | /** |
| 32 | * {@inheritdoc} |
| 33 | */ |
| 34 | protected function doWrite(string $message, bool $newline) |
| 35 | { |
| 36 | $this->buffer .= $message; |
| 37 | if ($newline) { |
| 38 | $this->buffer .= \PHP_EOL; |
| 39 | } |
| 40 | } |
| 41 | } |
| 42 |