StringOutput.php 665 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace Dcat\Admin\Support;
  3. use Symfony\Component\Console\Output\Output;
  4. class StringOutput extends Output
  5. {
  6. public $output = '';
  7. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = false, $formatter = null)
  8. {
  9. $formatter = $formatter ?: new OutputFormatter();
  10. parent::__construct($verbosity, $decorated, $formatter);
  11. }
  12. public function clear()
  13. {
  14. $this->output = '';
  15. }
  16. protected function doWrite($message, $newline)
  17. {
  18. $this->output .= $message.($newline ? "\n" : '');
  19. }
  20. public function getContent()
  21. {
  22. return trim($this->output);
  23. }
  24. }