Chats   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 2 1
A getMembers() 0 9 3
1
<?php
2
3
/**
4
 * Chats
5
 *
6
 * @author Alexey Krupskiy <[email protected]>
7
 * @link http://inji.ru/
8
 * @copyright 2015 Alexey Krupskiy
9
 * @license https://github.com/injitools/cms-Inji/blob/master/LICENSE
10
 */
11
class Chats extends Module {
12
13
    public function init() {
14
        App::$primary->view->customAsset('js', '/moduleAsset/Chats/js/chat.js');
15
    }
16
17
    public function getMembers($chatId) {
18
        $members = \Chats\Chat\Member::getList(['where' => ['chat_id', $chatId]]);
19
        foreach ($members as $key => $member) {
20
            if (strtotime($member->date_last_active) - time() > 30) {
0 ignored issues
show
Bug Best Practice introduced by
The property date_last_active does not exist on Inji\Model. Since you implemented __get, consider adding a @property annotation.
Loading history...
21
                $member->delete();
22
                unset($members[$key]);
23
            }
24
        }
25
        return $members;
26
    }
27
28
}
29