| Conditions | 4 |
| Paths | 5 |
| Total Lines | 10 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | public function __construct(bool $test = false) |
||
|
|
|||
| 11 | { |
||
| 12 | $this->test = $test; |
||
| 13 | |||
| 14 | // Save to object and free Session |
||
| 15 | if (session_status() === PHP_SESSION_ACTIVE) { |
||
| 16 | $this->message = (isset($_SESSION['message']) && $_SESSION['message']) ? $_SESSION['message'] : null; |
||
| 17 | unset($_SESSION['message']); |
||
| 18 | } |
||
| 19 | } |
||
| 20 | |||
| 51 |
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: