Completed
Push — v4.0-dev ( 6e38a6...59b8ca )
by Oscar
04:48
created

YamlDictionary::toString()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 2
eloc 5
nc 2
nop 1
1
<?php
2
3
namespace Gettext\Generators;
4
5
use Gettext\Translations;
6
use Symfony\Component\Yaml\Yaml;
7
8
class YamlDictionary extends Generator implements GeneratorInterface
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public static function toString(Translations $translations)
14
    {
15
        $messages = [];
16
17
        foreach ($translations as $translation) {
18
            $messages[$translation->getOriginal()] = $translation->getTranslation();
19
        }
20
21
        return Yaml::dump($messages);
22
    }
23
}
24