user_update   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
c 0
b 0
f 0
dl 0
loc 22
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A update_row() 0 7 1
A update_cooldown_time() 0 4 1
A __construct() 0 2 1
1
<?php
2
3
/**
4
* @Auther: bhief
5
* @Version: 1.0
6
*
7
* Sets user information (eg, cooldowns)
8
*
9
**/
10
class user_update {
11
    public $__db;
12
13
	public function __construct($conn){
14
        $this->__db = $conn;
15
	}
16
17
    // fuck this, this can be compressed into 2 functions
18
19
    function update_cooldown_time($username, $rowName) {
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...
20
        $stmt = $this->__db->prepare("UPDATE users SET ".$rowName." = now() WHERE username = :username");
21
        $stmt->bindParam(":username", $username);
22
        $stmt->execute();
23
    }
24
25
    function update_row($username, $rowName, $new) {
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...
26
        $stmt = $this->__db->prepare("UPDATE users SET ".$rowName." = :new WHERE username = :username");
27
        $stmt->bindParam(":new", $new);
28
        $stmt->bindParam(":username", $username);
29
        $stmt->execute();
30
        
31
        return true;
32
    }
33
}
34
35
?>
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...