| Conditions | 3 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | public function login($accountId, $password) |
||
|
|
|||
| 27 | { |
||
| 28 | if ( |
||
| 29 | $this->accountManager->isExistAccountId($accountId) === false |
||
| 30 | || $this->accountManager->isEqualPassword($accountId, $password) === false |
||
| 31 | ) { |
||
| 32 | throw new AccountNotFound('Invalid account id or password'); |
||
| 33 | } |
||
| 34 | |||
| 35 | $_SESSION['account'] = [ |
||
| 36 | 'id' => $accountId |
||
| 37 | ]; |
||
| 38 | } |
||
| 39 | |||
| 59 |
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: