Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array())
 {
     if (!class_exists('Symfony\\Component\\Yaml\\Yaml')) {
         throw new \LogicException('Dumping translations in the YAML format requires the Symfony Yaml component.');
     }
     $data = $messages->all($domain);
     if (isset($options['as_tree']) && $options['as_tree']) {
         $data = ArrayConverter::expandToTree($data);
     }
     if (isset($options['inline']) && ($inline = (int) $options['inline']) > 0) {
         return Yaml::dump($data, $inline);
     }
     return Yaml::dump($data);
 }
Ejemplo n.º 2
0
 /**
  * @dataProvider messsagesData
  */
 public function testDump($input, $expectedOutput)
 {
     $this->assertEquals($expectedOutput, ArrayConverter::expandToTree($input));
 }