Chris@0: Chris@0: * Chris@0: * For the full copyright and license information, please view the LICENSE Chris@0: * file that was distributed with this source code. Chris@0: */ Chris@0: Chris@0: namespace Symfony\Component\Console\Output; Chris@0: Chris@0: /** Chris@0: * @author Jean-François Simon Chris@0: */ Chris@0: class BufferedOutput extends Output Chris@0: { Chris@0: private $buffer = ''; Chris@0: Chris@0: /** Chris@0: * Empties buffer and returns its content. Chris@0: * Chris@0: * @return string Chris@0: */ Chris@0: public function fetch() Chris@0: { Chris@0: $content = $this->buffer; Chris@0: $this->buffer = ''; Chris@0: Chris@0: return $content; Chris@0: } Chris@0: Chris@0: /** Chris@0: * {@inheritdoc} Chris@0: */ Chris@0: protected function doWrite($message, $newline) Chris@0: { Chris@0: $this->buffer .= $message; Chris@0: Chris@0: if ($newline) { Chris@0: $this->buffer .= PHP_EOL; Chris@0: } Chris@0: } Chris@0: }