Passed
Push — main ( 3b40c1...b711d3 )
by Peter
07:24
created

Environment   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A unsetVar() 0 8 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Framework\Environments;
6
7
use Opulence\Environments\Environment as OpulenceEnvironment;
8
9
class Environment extends OpulenceEnvironment
10
{
11
    /**
12
     * Unsets an environment variable
13
     *
14
     * @param string $name The name of the environment variable to unset
15
     */
16
    public static function unsetVar(string $name)
17
    {
18
        putenv("$name");
19
        if (array_key_exists($name, $_ENV)) {
20
            unset($_ENV[$name]);
21
        }
22
        if (array_key_exists($name, $_SERVER)) {
23
            unset($_SERVER[$name]);
24
        }
25
    }
26
}
27