| Conditions | 5 |
| Paths | 4 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 19 | public function login(): bool |
||
| 20 | { |
||
| 21 | if (!isset($this->fields['username']) || !isset($this->fields['password'])) { |
||
| 22 | throw new Exception('something went wrong with the validation'); |
||
| 23 | } |
||
| 24 | |||
| 25 | $username = $this->fields['username']; |
||
| 26 | $strategies = [new IsNotEmptyValidationStrategy()]; |
||
| 27 | if (!$this->validate($username, $strategies)) { |
||
| 28 | return false; |
||
| 29 | } |
||
| 30 | |||
| 31 | $password = $this->fields['password']; |
||
| 32 | if (!$this->validate($password, $strategies)) { |
||
| 33 | return false; |
||
| 34 | } |
||
| 35 | |||
| 36 | return true; |
||
| 37 | } |
||
| 39 |