auth_model::is_admin()   A
last analyzed

Complexity

Conditions 4
Paths 3

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 6
nc 3
nop 1
dl 0
loc 11
rs 10
c 0
b 0
f 0
1
<?php
2
3
class auth_model extends Model {
4
5
    function __construct() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
6
        $this->load_library("db_lib");
7
    }
8
9
    // Is the user super-admin for Jugaad
10
    function is_admin($user) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
11
        global $admins;
12
13
        if (!isset($admins) || !is_array($admins)) {
14
            return false;
15
        }
16
17
        if (in_array($user, $admins)) {
18
            return true;
19
        }
20
        return false;
21
    }
22
}
23