| 1 |
<?php |
| 2 |
|
| 3 |
namespace Gettext\Generators; |
| 4 |
|
| 5 |
use Gettext\Translations; |
| 6 |
use Gettext\Utils\MultidimensionalArrayTrait; |
| 7 |
use Symfony\Component\Yaml\Yaml as YamlDumper; |
| 8 |
|
| 9 |
class Yaml extends Generator implements GeneratorInterface |
| 10 |
{ |
| 11 |
use MultidimensionalArrayTrait; |
| 12 |
|
| 13 |
public static $options = [ |
| 14 |
'includeHeaders' => false, |
| 15 |
'indent' => 2, |
| 16 |
'inline' => 4, |
| 17 |
]; |
| 18 |
|
| 19 |
/** |
| 20 |
* {@inheritdoc} |
| 21 |
*/ |
| 22 |
public static function toString(Translations $translations, array $options = []) |
| 23 |
{ |
| 24 |
$options += static::$options; |
| 25 |
|
| 26 |
return YamlDumper::dump( |
| 27 |
static::toArray($translations, $options['includeHeaders']), |
| 28 |
$options['inline'], |
| 29 |
$options['indent'] |
| 30 |
); |
| 31 |
} |
| 32 |
} |
| 33 |
|