Completed
Push — master ( f27ef8...e8179e )
by Pavel
02:17
created

YamlOutputAdapter::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 5
c 0
b 0
f 0
ccs 0
cts 4
cp 0
rs 9.4285
cc 1
eloc 2
nc 1
nop 1
crap 2
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
    public function __construct($parameterKey)
15
    {
16
17
        $this->parameterKey = $parameterKey;
18
    }
19
20
    public static function getName()
21
    {
22
        return 'yaml';
23
    }
24
25
    public function process($parameters, $fileName, $env)
26
    {
27
        file_put_contents($fileName, sprintf("# This file is auto-generated during the build process of '%s' environment at %s\n", $env, date(DATE_ATOM)) . Yaml::dump(array($this->parameterKey => $parameters)), 99);
28
    }
29
30
}