ProjectTemplateDebugger.php 858 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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\Templating\Tests\Fixtures;
  11. use Symfony\Component\Templating\DebuggerInterface;
  12. class ProjectTemplateDebugger implements DebuggerInterface
  13. {
  14. protected $messages = array();
  15. public function log($message)
  16. {
  17. $this->messages[] = $message;
  18. }
  19. public function hasMessage($regex)
  20. {
  21. foreach ($this->messages as $message) {
  22. if (preg_match('#'.preg_quote($regex, '#').'#', $message)) {
  23. return true;
  24. }
  25. }
  26. return false;
  27. }
  28. public function getMessages()
  29. {
  30. return $this->messages;
  31. }
  32. }