| Conditions | 2 |
| Paths | 2 |
| Total Lines | 21 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 44 | public function logined() |
||
| 45 | { |
||
| 46 | $query = new Query($this->container->db); |
||
|
|
|||
| 47 | $query->addWhere('login = :login'); |
||
| 48 | $query->addWhere('pass = :pass'); |
||
| 49 | |||
| 50 | $query->params = [ |
||
| 51 | 'login' => $this->login, |
||
| 52 | 'pass' => md5($this->password) |
||
| 53 | ]; |
||
| 54 | |||
| 55 | if ($user = User::finder($query, true)) { |
||
| 56 | $this->container->session->UserID = $user->id; |
||
| 57 | |||
| 58 | return true; |
||
| 59 | } else { |
||
| 60 | $this->addError('Логин или пароль не верны.'); |
||
| 61 | |||
| 62 | return false; |
||
| 63 | } |
||
| 64 | } |
||
| 65 | } |
||
| 66 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: