@@ -6,8 +6,7 @@ discard block |
||
| 6 | 6 | use Gettext\Utils\DictionaryTrait; |
| 7 | 7 | use Symfony\Component\Yaml\Yaml as YamlDumper; |
| 8 | 8 | |
| 9 | -class YamlDictionary extends Generator implements GeneratorInterface |
|
| 10 | -{ |
|
| 9 | +class YamlDictionary extends Generator implements GeneratorInterface { |
|
| 11 | 10 | use DictionaryTrait; |
| 12 | 11 | |
| 13 | 12 | public static $options = [ |
@@ -19,8 +18,7 @@ discard block |
||
| 19 | 18 | /** |
| 20 | 19 | * {@inheritdoc} |
| 21 | 20 | */ |
| 22 | - public static function toString(Translations $translations, array $options = []) |
|
| 23 | - { |
|
| 21 | + public static function toString(Translations $translations, array $options = []) { |
|
| 24 | 22 | $options += static::$options; |
| 25 | 23 | |
| 26 | 24 | return YamlDumper::dump( |
@@ -9,8 +9,7 @@ discard block |
||
| 9 | 9 | /** |
| 10 | 10 | * Class to export translations to csv. |
| 11 | 11 | */ |
| 12 | -class Csv extends Generator implements GeneratorInterface |
|
| 13 | -{ |
|
| 12 | +class Csv extends Generator implements GeneratorInterface { |
|
| 14 | 13 | use HeadersGeneratorTrait; |
| 15 | 14 | use CsvTrait; |
| 16 | 15 | |
@@ -24,8 +23,7 @@ discard block |
||
| 24 | 23 | /** |
| 25 | 24 | * {@parentDoc}. |
| 26 | 25 | */ |
| 27 | - public static function toString(Translations $translations, array $options = []) |
|
| 28 | - { |
|
| 26 | + public static function toString(Translations $translations, array $options = []) { |
|
| 29 | 27 | $options += static::$options; |
| 30 | 28 | $handle = fopen('php://memory', 'w'); |
| 31 | 29 | |
@@ -5,8 +5,7 @@ discard block |
||
| 5 | 5 | use Gettext\Translations; |
| 6 | 6 | use Gettext\Utils\DictionaryTrait; |
| 7 | 7 | |
| 8 | -class JsonDictionary extends Generator implements GeneratorInterface |
|
| 9 | -{ |
|
| 8 | +class JsonDictionary extends Generator implements GeneratorInterface { |
|
| 10 | 9 | use DictionaryTrait; |
| 11 | 10 | |
| 12 | 11 | public static $options = [ |
@@ -17,8 +16,7 @@ discard block |
||
| 17 | 16 | /** |
| 18 | 17 | * {@parentDoc}. |
| 19 | 18 | */ |
| 20 | - public static function toString(Translations $translations, array $options = []) |
|
| 21 | - { |
|
| 19 | + public static function toString(Translations $translations, array $options = []) { |
|
| 22 | 20 | $options += static::$options; |
| 23 | 21 | |
| 24 | 22 | return json_encode(static::toArray($translations, $options['includeHeaders']), $options['json']); |
@@ -5,8 +5,7 @@ discard block |
||
| 5 | 5 | use Gettext\Translations; |
| 6 | 6 | use Gettext\Utils\HeadersGeneratorTrait; |
| 7 | 7 | |
| 8 | -class Mo extends Generator implements GeneratorInterface |
|
| 9 | -{ |
|
| 8 | +class Mo extends Generator implements GeneratorInterface { |
|
| 10 | 9 | use HeadersGeneratorTrait; |
| 11 | 10 | |
| 12 | 11 | public static $options = [ |
@@ -16,8 +15,7 @@ discard block |
||
| 16 | 15 | /** |
| 17 | 16 | * {@parentDoc}. |
| 18 | 17 | */ |
| 19 | - public static function toString(Translations $translations, array $options = []) |
|
| 20 | - { |
|
| 18 | + public static function toString(Translations $translations, array $options = []) { |
|
| 21 | 19 | $options += static::$options; |
| 22 | 20 | $messages = []; |
| 23 | 21 | |
@@ -4,8 +4,7 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | use Gettext\Translations; |
| 6 | 6 | |
| 7 | -class Jed extends Generator implements GeneratorInterface |
|
| 8 | -{ |
|
| 7 | +class Jed extends Generator implements GeneratorInterface { |
|
| 9 | 8 | public static $options = [ |
| 10 | 9 | 'json' => 0, |
| 11 | 10 | ]; |
@@ -13,8 +12,7 @@ discard block |
||
| 13 | 12 | /** |
| 14 | 13 | * {@parentDoc}. |
| 15 | 14 | */ |
| 16 | - public static function toString(Translations $translations, array $options = []) |
|
| 17 | - { |
|
| 15 | + public static function toString(Translations $translations, array $options = []) { |
|
| 18 | 16 | $domain = $translations->getDomain() ?: 'messages'; |
| 19 | 17 | $options += static::$options; |
| 20 | 18 | |
@@ -36,8 +34,7 @@ discard block |
||
| 36 | 34 | * |
| 37 | 35 | * @return array |
| 38 | 36 | */ |
| 39 | - protected static function buildMessages(Translations $translations) |
|
| 40 | - { |
|
| 37 | + protected static function buildMessages(Translations $translations) { |
|
| 41 | 38 | $pluralForm = $translations->getPluralForms(); |
| 42 | 39 | $pluralSize = is_array($pluralForm) ? ($pluralForm[0] - 1) : null; |
| 43 | 40 | $messages = []; |
@@ -4,8 +4,7 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | use Gettext\Translations; |
| 6 | 6 | |
| 7 | -class Po extends Generator implements GeneratorInterface |
|
| 8 | -{ |
|
| 7 | +class Po extends Generator implements GeneratorInterface { |
|
| 9 | 8 | public static $options = [ |
| 10 | 9 | 'noLocation' => false, |
| 11 | 10 | ]; |
@@ -13,8 +12,7 @@ discard block |
||
| 13 | 12 | /** |
| 14 | 13 | * {@parentDoc}. |
| 15 | 14 | */ |
| 16 | - public static function toString(Translations $translations, array $options = []) |
|
| 17 | - { |
|
| 15 | + public static function toString(Translations $translations, array $options = []) { |
|
| 18 | 16 | $options += static::$options; |
| 19 | 17 | |
| 20 | 18 | $pluralForm = $translations->getPluralForms(); |
@@ -83,8 +81,7 @@ discard block |
||
| 83 | 81 | * |
| 84 | 82 | * @return string |
| 85 | 83 | */ |
| 86 | - protected static function multilineQuote($string) |
|
| 87 | - { |
|
| 84 | + protected static function multilineQuote($string) { |
|
| 88 | 85 | $lines = explode("\n", $string); |
| 89 | 86 | $last = count($lines) - 1; |
| 90 | 87 | |
@@ -106,8 +103,7 @@ discard block |
||
| 106 | 103 | * @param string $name |
| 107 | 104 | * @param string $value |
| 108 | 105 | */ |
| 109 | - protected static function addLines(array &$lines, $name, $value) |
|
| 110 | - { |
|
| 106 | + protected static function addLines(array &$lines, $name, $value) { |
|
| 111 | 107 | $newLines = static::multilineQuote($value); |
| 112 | 108 | |
| 113 | 109 | if (count($newLines) === 1) { |
@@ -128,8 +124,7 @@ discard block |
||
| 128 | 124 | * |
| 129 | 125 | * @return string |
| 130 | 126 | */ |
| 131 | - public static function convertString($value) |
|
| 132 | - { |
|
| 127 | + public static function convertString($value) { |
|
| 133 | 128 | return '"'.strtr( |
| 134 | 129 | $value, |
| 135 | 130 | [ |
@@ -5,8 +5,7 @@ discard block |
||
| 5 | 5 | use Gettext\Translations; |
| 6 | 6 | use Gettext\Utils\MultidimensionalArrayTrait; |
| 7 | 7 | |
| 8 | -class Json extends Generator implements GeneratorInterface |
|
| 9 | -{ |
|
| 8 | +class Json extends Generator implements GeneratorInterface { |
|
| 10 | 9 | use MultidimensionalArrayTrait; |
| 11 | 10 | |
| 12 | 11 | public static $options = [ |
@@ -17,8 +16,7 @@ discard block |
||
| 17 | 16 | /** |
| 18 | 17 | * {@inheritdoc} |
| 19 | 18 | */ |
| 20 | - public static function toString(Translations $translations, array $options = []) |
|
| 21 | - { |
|
| 19 | + public static function toString(Translations $translations, array $options = []) { |
|
| 22 | 20 | $options += static::$options; |
| 23 | 21 | |
| 24 | 22 | return json_encode(static::toArray($translations, $options['includeHeaders'], true), $options['json']); |
@@ -4,13 +4,11 @@ |
||
| 4 | 4 | |
| 5 | 5 | use Gettext\Translations; |
| 6 | 6 | |
| 7 | -abstract class Generator implements GeneratorInterface |
|
| 8 | -{ |
|
| 7 | +abstract class Generator implements GeneratorInterface { |
|
| 9 | 8 | /** |
| 10 | 9 | * {@inheritdoc} |
| 11 | 10 | */ |
| 12 | - public static function toFile(Translations $translations, $file, array $options = []) |
|
| 13 | - { |
|
| 11 | + public static function toFile(Translations $translations, $file, array $options = []) { |
|
| 14 | 12 | $content = static::toString($translations, $options); |
| 15 | 13 | |
| 16 | 14 | if (file_put_contents($file, $content) === false) { |
@@ -6,8 +6,7 @@ discard block |
||
| 6 | 6 | use Gettext\Utils\MultidimensionalArrayTrait; |
| 7 | 7 | use Symfony\Component\Yaml\Yaml as YamlDumper; |
| 8 | 8 | |
| 9 | -class Yaml extends Generator implements GeneratorInterface |
|
| 10 | -{ |
|
| 9 | +class Yaml extends Generator implements GeneratorInterface { |
|
| 11 | 10 | use MultidimensionalArrayTrait; |
| 12 | 11 | |
| 13 | 12 | public static $options = [ |
@@ -19,8 +18,7 @@ discard block |
||
| 19 | 18 | /** |
| 20 | 19 | * {@inheritdoc} |
| 21 | 20 | */ |
| 22 | - public static function toString(Translations $translations, array $options = []) |
|
| 23 | - { |
|
| 21 | + public static function toString(Translations $translations, array $options = []) { |
|
| 24 | 22 | $options += static::$options; |
| 25 | 23 | |
| 26 | 24 | return YamlDumper::dump( |