Drupal investigation

IniFileDumper.php 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. * IniFileDumper generates an ini formatted string representation of a message catalogue.
  14. *
  15. * @author Stealth35
  16. */
  17. class IniFileDumper extends FileDumper
  18. {
  19. /**
  20. * {@inheritdoc}
  21. */
  22. public function format(MessageCatalogue $messages, $domain = 'messages')
  23. {
  24. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0. Use the formatCatalogue() method instead.', E_USER_DEPRECATED);
  25. return $this->formatCatalogue($messages, $domain);
  26. }
  27. /**
  28. * {@inheritdoc}
  29. */
  30. public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array())
  31. {
  32. $output = '';
  33. foreach ($messages->all($domain) as $source => $target) {
  34. $escapeTarget = str_replace('"', '\"', $target);
  35. $output .= $source.'="'.$escapeTarget."\"\n";
  36. }
  37. return $output;
  38. }
  39. /**
  40. * {@inheritdoc}
  41. */
  42. protected function getExtension()
  43. {
  44. return 'ini';
  45. }
  46. }