Jobs_logs   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 92
Duplicated Lines 39.13 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 1
dl 36
loc 92
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A index() 0 6 1
A intranet() 0 21 1
A dashboard() 18 18 1
A passkey() 18 18 1
A ad_user_sync() 0 17 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
defined('BASEPATH') OR exit('No direct script access allowed');
4
5
class Jobs_logs extends My_Force_Admin {
6
7
    public function __construct() {
8
        parent::__construct();
9
        $this->load->library('grocery_CRUD');
10
    }
11
12
    public function index() {
13
14
        $this->load->view('templates/header');
15
        $this->load->view('admin/jobs-logs/view');
16
        $this->load->view('templates/footer');
17
    }
18
    
19
    public function intranet() {
20
        
21
        $this->db = $this->load->database('intranet',true);
22
        
23
        $crud = new grocery_CRUD();
24
        $crud->set_table('Logs');
25
        $crud->set_subject('Logs', 'Logs');
26
        $crud->unset_delete();
27
        $crud->unset_read();
28
        $crud->unset_add();
29
        $crud->unset_edit();
30
        $output = $crud->render();
31
        
32
        $this->db = $this->load->database('default',true);
33
        
34
        $this->load->view('templates/header.php');
35
        $this->load->view('admin/jobs-logs/intranet', $output);
36
        $this->load->view('templates/footer.php');
37
        $this->load->view('templates/table_assets.php', $output);
38
        
39
    }
40
    
41 View Code Duplication
    public function dashboard() {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
42
43
        $crud = new grocery_CRUD();
44
        $crud->set_table('users_log');
45
        $crud->set_subject('Dashboard Logs', 'Dashboard Logs');
46
        $crud->unset_columns('id');
47
        $crud->display_as('ip','IP')->display_as('url','URL');
48
        $crud->unset_edit();
49
        $crud->unset_delete();
50
        $crud->unset_add();
51
        $crud->unset_read();
52
        $output = $crud->render();
53
54
        $this->load->view('templates/header.php');
55
        $this->load->view('admin/jobs-logs/dashboard', $output);
56
        $this->load->view('templates/footer.php');
57
        $this->load->view('templates/table_assets.php', $output);
58
    }
59
    
60 View Code Duplication
    public function passkey() {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
61
62
        $crud = new grocery_CRUD();
63
        $crud->set_table('passkey_log');
64
        $crud->set_subject('Passkey', 'Passkey');
65
        $crud->unset_columns('id');
66
        $crud->display_as('ip','IP')->display_as('passid','PassID');
67
        $crud->unset_edit();
68
        $crud->unset_delete();
69
        $crud->unset_add();
70
        $crud->unset_read();
71
        $output = $crud->render();
72
73
        $this->load->view('templates/header.php');
74
        $this->load->view('admin/jobs-logs/passkey', $output);
75
        $this->load->view('templates/footer.php');
76
        $this->load->view('templates/table_assets.php', $output);
77
    }
78
    
79
    public function ad_user_sync() {
80
81
        $crud = new grocery_CRUD();
82
        $crud->set_table('users_ad_log');
83
        $crud->set_subject('AD User Sync', 'AD User Sync');
84
        $crud->unset_columns('id');
85
        $crud->unset_edit();
86
        $crud->unset_delete();
87
        $crud->unset_add();
88
        $crud->unset_read();
89
        $output = $crud->render();
90
91
        $this->load->view('templates/header.php');
92
        $this->load->view('admin/jobs-logs/ad-user-sync', $output);
93
        $this->load->view('templates/footer.php');
94
        $this->load->view('templates/table_assets.php', $output);
95
    }
96
}
97
98
// END controller
99