| Conditions | 3 |
| Paths | 2 |
| Total Lines | 24 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 32 | public function usersLoginFailed(Event $event) |
||
| 33 | { |
||
| 34 | //Email. |
||
| 35 | $this->Groups = TableRegistry::get('Groups'); |
||
|
|
|||
| 36 | $group = $this->Groups |
||
| 37 | ->find() |
||
| 38 | ->where(['id' => $event->data['group_id']]) |
||
| 39 | ->first(); |
||
| 40 | |||
| 41 | if (is_null($group) || (bool)$group->is_staff === false) { |
||
| 42 | return true; |
||
| 43 | } |
||
| 44 | |||
| 45 | $viewVars = [ |
||
| 46 | 'user_ip' => $event->data['user_ip'], |
||
| 47 | 'username' => $event->data['username'], |
||
| 48 | 'user_agent' => $event->data['user_agent'], |
||
| 49 | 'email' => $event->data['user_email'] |
||
| 50 | ]; |
||
| 51 | |||
| 52 | $this->getMailer('User')->send('login', [$viewVars]); |
||
| 53 | |||
| 54 | return true; |
||
| 55 | } |
||
| 56 | } |
||
| 57 |
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: