ShhEnvVarProcessor   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 7
c 1
b 0
f 0
dl 0
loc 34
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getEnv() 0 5 1
A getProvidedTypes() 0 4 1
A __construct() 0 3 1
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