Envs   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
wmc 4
eloc 10
c 0
b 0
f 0
dl 0
loc 27
ccs 6
cts 12
cp 0.5
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A constantsRequired() 0 3 1
A envsRequired() 0 3 1
A paramsRequired() 0 3 1
A writeFile() 0 10 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 ConfigOutput
13
{
14 2
    protected function writeFile(string $path, array $data): void
15
    {
16 2
        $envs = Helper::exportVar($data);
17
18
        $content = <<<PHP
19 2
<?php
20 2
return {$envs};
21
PHP;
22
23 2
        $this->contentWriter->write($path, $content . PHP_EOL);
24 2
    }
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