| Conditions | 1 |
| Paths | 1 |
| Total Lines | 18 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 36 | public function unset(string $name) |
||
| 37 | { |
||
| 38 | global $_SERVER; |
||
| 39 | Assertion::true(putenv($name), "Could not unset env with name '$name'."); |
||
| 40 | Assertion::same( |
||
| 41 | null, |
||
| 42 | $retrieved = $this->get($name), |
||
| 43 | "Failed asserting that env with name '$name' has been unset. ". |
||
| 44 | "Retrieved value was '$retrieved'." |
||
| 45 | ); |
||
| 46 | /** |
||
| 47 | * @see \Symfony\Component\Process\Process::getDefaultEnv |
||
| 48 | */ |
||
| 49 | unset($_SERVER[$name]); |
||
| 50 | Assertion::keyNotExists( |
||
| 51 | $_SERVER, |
||
| 52 | $name, |
||
| 53 | "Failed asserting that env with name '$name' has been unset in global _SERVER." |
||
| 54 | ); |
||
| 58 |
Instead of relying on
globalstate, we recommend one of these alternatives:1. Pass all data via parameters
2. Create a class that maintains your state