Passed
Push — master ( f5390f...ff2936 )
by Alexander
02:09
created

Envs::writeFile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 6
c 0
b 0
f 0
dl 0
loc 10
ccs 5
cts 5
cp 1
rs 10
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Composer\Config\Config;
6
7
use Yiisoft\Composer\Config\Util\Helper;
8
9
/**
10
 * DotEnv class represents output configuration file with ENV values.
11
 */
12
class Envs extends Config
13
{
14 1
    protected function writeFile(string $path, array $data): void
15
    {
16 1
        $envs = Helper::exportVar($data);
17
18
        $content = <<<PHP
19 1
<?php
20 1
return {$envs};
21
PHP;
22
23 1
        $this->contentWriter->write($path, $content . PHP_EOL);
24 1
    }
25
26
    protected function envsRequired(): bool
27
    {
28
        return false;
29
    }
30
31
    protected function constantsRequired(): bool
32
    {
33
        return false;
34
    }
35
36
    protected function paramsRequired(): bool
37
    {
38
        return false;
39
    }
40
}
41