DummyOutput.php 799 B

123456789101112131415161718192021222324252627282930313233343536
  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("\n", 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. }