Completed
Push — master ( 4f2fad...dd1cd3 )
by Guillaume
07:10
created

ConfigurationDumper::dumpConfiguration()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 3
Ratio 33.33 %
Metric Value
dl 3
loc 9
rs 9.6667
cc 2
eloc 5
nc 2
nop 1
1
<?php
2
3
namespace Hogosha\Monitor\Configuration;
4
5
use Symfony\Component\Yaml\Yaml;
6
7
class ConfigurationDumper
8
{
9
    /**
10
     * Dump configuration array to valid file content.
11
     *
12
     * @param array $config The configuration
13
     *
14
     * @return string The dumped configuration
15
     */
16
    public function dumpConfiguration(array $config)
17
    {
18
        $content = '';
19 View Code Duplication
        foreach ($config as $name => $section) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
20
            $content .= Yaml::dump([$name => $section], 4).PHP_EOL;
21
        }
22
23
        return $content;
24
    }
25
}
26