Completed
Push — master ( 8f7820...869ce5 )
by Pavel
02:09
created

YamlOutputAdapter   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 24
ccs 8
cts 8
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A process() 0 4 1
A getName() 0 4 1
1
<?php
2
3
namespace Paro\EnvironmentParameters\Adapter\Output;
4
5
use Symfony\Component\Yaml\Yaml;
6
7
class YamlOutputAdapter implements OutputAdapterInterface
8
{
9
    /**
10
     * @var string
11
     */
12
    private $parameterKey;
13
14 3
    public function __construct($parameterKey)
15
    {
16
17 3
        $this->parameterKey = $parameterKey;
18 3
    }
19
20 1
    public static function getName()
21
    {
22 1
        return 'yaml';
23
    }
24
25 2
    public function process($parameters, $fileName, $env, $date)
26
    {
27 2
        file_put_contents($fileName, sprintf("# This file is auto-generated during the build process of '%s' environment at %s\n", $env, date(DATE_ATOM, $date)) . Yaml::dump(array($this->parameterKey => $parameters)));
28 2
    }
29
30
}