| Conditions | 2 |
| Paths | 2 |
| Total Lines | 11 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 33 | public function check(Session $session): bool |
||
| 34 | { |
||
| 35 | $lastActivated = $session->get(self::SUDO_MODE_SESSION_KEY); |
||
| 36 | // Not activated at all |
||
| 37 | if (!$lastActivated) { |
||
| 38 | return false; |
||
| 39 | } |
||
| 40 | |||
| 41 | // Activated within the last "lifetime" window |
||
| 42 | $nowTimestamp = DBDatetime::now()->getTimestamp(); |
||
| 43 | return $lastActivated > ($nowTimestamp - $this->getLifetime() * 60); |
||
| 44 | } |
||
| 57 |