Conditions | 4 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
35 | 9 | public function isAuthenticated() |
|
36 | { |
||
37 | 9 | $cookie = $this->cookiePath; |
|
38 | 9 | $cookieLifetime = time() - 60 * 14; // 14 minutes |
|
39 | |||
40 | 9 | if ((!file_exists($cookie)) || (filemtime($cookie) <= $cookieLifetime)) { |
|
41 | 2 | return false; |
|
42 | } |
||
43 | |||
44 | // If login has been changed, we need to delete the cookie file for the changes to take effect |
||
45 | 7 | if (false === mb_strpos(file_get_contents($cookie), str_replace('@', '%40', $this->login))) { |
|
46 | 1 | unlink($cookie); |
|
47 | |||
48 | 1 | return false; |
|
49 | } |
||
50 | |||
51 | 6 | return true; |
|
52 | } |
||
54 |