auth_model   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 5
Bugs 1 Features 0
Metric Value
eloc 8
dl 0
loc 18
rs 10
c 5
b 1
f 0
wmc 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A is_admin() 0 11 4
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