| Conditions | 3 |
| Paths | 3 |
| Total Lines | 12 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 61 | public function reset() |
||
| 62 | { |
||
| 63 | if (false === isset($this->backup)) { |
||
| 64 | throw new BadMethodCallException('Environment not yet backed up, initalize first, can\'t reset'); |
||
| 65 | } |
||
| 66 | |||
| 67 | foreach ($this->backup as $key => $value) { |
||
| 68 | $_SERVER[$key] = $value; |
||
| 69 | } |
||
| 70 | |||
| 71 | $this->backup = null; |
||
| 72 | } |
||
| 73 | } |
||
| 74 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: