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

YamlOutputAdapter::getName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 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
}