Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/translation/Writer/TranslationWriter.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
19 /** | 19 /** |
20 * TranslationWriter writes translation messages. | 20 * TranslationWriter writes translation messages. |
21 * | 21 * |
22 * @author Michel Salib <michelsalib@hotmail.com> | 22 * @author Michel Salib <michelsalib@hotmail.com> |
23 */ | 23 */ |
24 class TranslationWriter | 24 class TranslationWriter implements TranslationWriterInterface |
25 { | 25 { |
26 /** | |
27 * Dumpers used for export. | |
28 * | |
29 * @var array | |
30 */ | |
31 private $dumpers = array(); | 26 private $dumpers = array(); |
32 | 27 |
33 /** | 28 /** |
34 * Adds a dumper to the writer. | 29 * Adds a dumper to the writer. |
35 * | 30 * |
64 } | 59 } |
65 | 60 |
66 /** | 61 /** |
67 * Writes translation from the catalogue according to the selected format. | 62 * Writes translation from the catalogue according to the selected format. |
68 * | 63 * |
69 * @param MessageCatalogue $catalogue The message catalogue to dump | 64 * @param MessageCatalogue $catalogue The message catalogue to write |
70 * @param string $format The format to use to dump the messages | 65 * @param string $format The format to use to dump the messages |
71 * @param array $options Options that are passed to the dumper | 66 * @param array $options Options that are passed to the dumper |
72 * | 67 * |
73 * @throws InvalidArgumentException | 68 * @throws InvalidArgumentException |
74 */ | 69 */ |
75 public function writeTranslations(MessageCatalogue $catalogue, $format, $options = array()) | 70 public function write(MessageCatalogue $catalogue, $format, $options = array()) |
76 { | 71 { |
77 if (!isset($this->dumpers[$format])) { | 72 if (!isset($this->dumpers[$format])) { |
78 throw new InvalidArgumentException(sprintf('There is no dumper associated with format "%s".', $format)); | 73 throw new InvalidArgumentException(sprintf('There is no dumper associated with format "%s".', $format)); |
79 } | 74 } |
80 | 75 |
86 } | 81 } |
87 | 82 |
88 // save | 83 // save |
89 $dumper->dump($catalogue, $options); | 84 $dumper->dump($catalogue, $options); |
90 } | 85 } |
86 | |
87 /** | |
88 * Writes translation from the catalogue according to the selected format. | |
89 * | |
90 * @param MessageCatalogue $catalogue The message catalogue to write | |
91 * @param string $format The format to use to dump the messages | |
92 * @param array $options Options that are passed to the dumper | |
93 * | |
94 * @throws InvalidArgumentException | |
95 * | |
96 * @deprecated since 3.4 will be removed in 4.0. Use write instead. | |
97 */ | |
98 public function writeTranslations(MessageCatalogue $catalogue, $format, $options = array()) | |
99 { | |
100 @trigger_error(sprintf('Method %s() is deprecated since Symfony 3.4 and will be removed in 4.0. Use write() instead.', __METHOD__), E_USER_DEPRECATED); | |
101 $this->write($catalogue, $format, $options); | |
102 } | |
91 } | 103 } |