YamlDictionary::toString()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 7
Ratio 70 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 7
loc 10
rs 9.9332
c 0
b 0
f 0
1
<?php
2
3
namespace Gettext\Generators;
4
5
use Gettext\Translations;
6
use Gettext\Utils\DictionaryTrait;
7
use Symfony\Component\Yaml\Yaml as YamlDumper;
8
9 View Code Duplication
class YamlDictionary extends Generator implements GeneratorInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
10
{
11
    use DictionaryTrait;
12
13
    public static $options = [
14
        'includeHeaders' => false,
15
        'indent' => 2,
16
        'inline' => 3,
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