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

PHPConstantsOutputAdapter   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 17
c 0
b 0
f 0
wmc 4
lcom 0
cbo 0
ccs 0
cts 12
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 4 1
A process() 0 8 3
1
<?php
2
3
namespace Paro\EnvironmentParameters\Adapter\Output;
4
5
6
class PHPConstantsOutputAdapter implements OutputAdapterInterface
7
{
8
    public static function getName()
9
    {
10
        return 'php-constants';
11
    }
12
13
    public function process($parameters, $fileName, $env)
14
    {
15
        $content = sprintf("<?php\n/** This file is auto-generated during the build process of '%s' environment at %s **/\n", $env, date(DATE_ATOM));
16
        foreach ($parameters as $key => $value) {
17
            $content .= sprintf("define('%s', '%s');\n", $key, is_array($value) ? serialize($value) : addslashes($value));
18
        };
19
        file_put_contents($fileName, $content, 99);
20
    }
21
22
}