Equipment_loan_model   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 68.18 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 15
loc 22
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A loan() 15 15 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 defined('BASEPATH') OR exit('No direct script access allowed');
2
3
class Equipment_loan_model extends CI_Model {
4
5
    public function __construct() {
6
    }
7
8 View Code Duplication
    public function loan($logged, $full_name, $ern, $make, $model, $sn) {
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...
9
        
10
        $data = array(
11
            'logged' => $this->input->post('logged'),
12
            'full_name' => $this->input->post('full_name'),
13
            'ern' => $this->input->post('ern'),
14
            'make' => $this->input->post('make'),
15
            'model' => $this->input->post('model'),
16
            'sn' => $this->input->post('sn'),
17
            'date' => date("Y-m-d H:i:s", time()),
18
        );
19
        
20
        return $this->db->insert('equipment_loan', $data);
21
        
22
    }
23
24
}
25
?>
0 ignored issues
show
Best Practice introduced by
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
26
27
28