ShhEnvVarProcessor::getEnv()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 3
1
<?php
2
3
namespace BenTools\Shh;
4
5
use Symfony\Component\DependencyInjection\EnvVarProcessorInterface;
6
7
final class ShhEnvVarProcessor implements EnvVarProcessorInterface
8
{
9
    /**
10
     * @var Shh
11
     */
12
    private $shh;
13
14
    /**
15
     * ShhEnvVarProcessor constructor.
16
     *
17
     * @param Shh $shh
18
     */
19
    public function __construct(Shh $shh)
20
    {
21
        $this->shh = $shh;
22
    }
23
24
    /**
25
     * @inheritDoc
26
     */
27
    public function getEnv($prefix, $name, \Closure $getEnv): mixed
28
    {
29
        $env = $getEnv($name);
30
31
        return $this->shh->decrypt($env);
32
    }
33
34
    /**
35
     * @inheritDoc
36
     */
37
    public static function getProvidedTypes(): array
38
    {
39
        return [
40
            'shh' => 'string',
41
        ];
42
    }
43
}
44