DummyOutput.php 802 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Console\Tests\Fixtures;
  11. use Symfony\Component\Console\Output\BufferedOutput;
  12. /**
  13. * Dummy output.
  14. *
  15. * @author Kévin Dunglas <dunglas@gmail.com>
  16. */
  17. class DummyOutput extends BufferedOutput
  18. {
  19. /**
  20. * @return array
  21. */
  22. public function getLogs()
  23. {
  24. $logs = array();
  25. foreach (explode(PHP_EOL, trim($this->fetch())) as $message) {
  26. preg_match('/^\[(.*)\] (.*)/', $message, $matches);
  27. $logs[] = sprintf('%s %s', $matches[1], $matches[2]);
  28. }
  29. return $logs;
  30. }
  31. }