PhpFileDumper.php 844 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\Translation\Dumper;
  11. use Symfony\Component\Translation\MessageCatalogue;
  12. /**
  13. * PhpFileDumper generates php files from a message catalogue.
  14. *
  15. * @author Michel Salib <michelsalib@hotmail.com>
  16. */
  17. class PhpFileDumper extends FileDumper
  18. {
  19. /**
  20. * {@inheritDoc}
  21. */
  22. protected function format(MessageCatalogue $messages, $domain)
  23. {
  24. $output = "<?php\n\nreturn ".var_export($messages->all($domain), true).";\n";
  25. return $output;
  26. }
  27. /**
  28. * {@inheritDoc}
  29. */
  30. protected function getExtension()
  31. {
  32. return 'php';
  33. }
  34. }