Conditions | 1 |
Paths | 1 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
10 | public function put(string $name, string $value) |
||
11 | { |
||
12 | global $_SERVER; |
||
|
|||
13 | Assertion::true(putenv($name.'='.$value), "Could not put env with name '$name' and value '$value'."); |
||
14 | Assertion::same( |
||
15 | $value, |
||
16 | $retrieved = $this->get($name), |
||
17 | "Failed asserting that value '$value' for env with name '$name' has been preserved when putting it. ". |
||
18 | "Retrieved value was '$retrieved'." |
||
19 | ); |
||
20 | /** |
||
21 | * @see \Symfony\Component\Process\Process::getDefaultEnv |
||
22 | */ |
||
23 | $_SERVER[$name] = $value; |
||
24 | } |
||
58 |
Instead of relying on
global
state, we recommend one of these alternatives:1. Pass all data via parameters
2. Create a class that maintains your state