Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/translation/Writer/TranslationWriter.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 1fec387a4317 |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
9 * file that was distributed with this source code. | 9 * file that was distributed with this source code. |
10 */ | 10 */ |
11 | 11 |
12 namespace Symfony\Component\Translation\Writer; | 12 namespace Symfony\Component\Translation\Writer; |
13 | 13 |
14 use Symfony\Component\Translation\MessageCatalogue; | |
15 use Symfony\Component\Translation\Dumper\DumperInterface; | 14 use Symfony\Component\Translation\Dumper\DumperInterface; |
16 use Symfony\Component\Translation\Exception\InvalidArgumentException; | 15 use Symfony\Component\Translation\Exception\InvalidArgumentException; |
17 use Symfony\Component\Translation\Exception\RuntimeException; | 16 use Symfony\Component\Translation\Exception\RuntimeException; |
17 use Symfony\Component\Translation\MessageCatalogue; | |
18 | 18 |
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 implements TranslationWriterInterface | 24 class TranslationWriter implements TranslationWriterInterface |
25 { | 25 { |
26 private $dumpers = array(); | 26 private $dumpers = []; |
27 | 27 |
28 /** | 28 /** |
29 * Adds a dumper to the writer. | 29 * Adds a dumper to the writer. |
30 * | 30 * |
31 * @param string $format The format of the dumper | 31 * @param string $format The format of the dumper |
65 * @param string $format The format to use to dump the messages | 65 * @param string $format The format to use to dump the messages |
66 * @param array $options Options that are passed to the dumper | 66 * @param array $options Options that are passed to the dumper |
67 * | 67 * |
68 * @throws InvalidArgumentException | 68 * @throws InvalidArgumentException |
69 */ | 69 */ |
70 public function write(MessageCatalogue $catalogue, $format, $options = array()) | 70 public function write(MessageCatalogue $catalogue, $format, $options = []) |
71 { | 71 { |
72 if (!isset($this->dumpers[$format])) { | 72 if (!isset($this->dumpers[$format])) { |
73 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)); |
74 } | 74 } |
75 | 75 |
93 * | 93 * |
94 * @throws InvalidArgumentException | 94 * @throws InvalidArgumentException |
95 * | 95 * |
96 * @deprecated since 3.4 will be removed in 4.0. Use write instead. | 96 * @deprecated since 3.4 will be removed in 4.0. Use write instead. |
97 */ | 97 */ |
98 public function writeTranslations(MessageCatalogue $catalogue, $format, $options = array()) | 98 public function writeTranslations(MessageCatalogue $catalogue, $format, $options = []) |
99 { | 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); | 100 @trigger_error(sprintf('The "%s()" method 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); | 101 $this->write($catalogue, $format, $options); |
102 } | 102 } |
103 } | 103 } |