| Conditions | 3 |
| Paths | 3 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 50 | public function authenticate() |
||
| 51 | { |
||
| 52 | if ( |
||
| 53 | isset($_SERVER['PHP_AUTH_USER']) |
||
| 54 | ) { |
||
| 55 | $this->username = $_SERVER['PHP_AUTH_USER']; |
||
| 56 | |||
| 57 | $user = array( |
||
| 58 | 'username' => $_SERVER['PHP_AUTH_USER'], |
||
| 59 | 'password' => $_SERVER['PHP_AUTH_PW'] |
||
| 60 | ); |
||
| 61 | if (true === $this->getToken($user)) { |
||
| 62 | return true; |
||
| 63 | } |
||
| 64 | } |
||
| 65 | |||
| 66 | return $this->send(); |
||
| 67 | } |
||
| 68 | |||
| 70 |
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: