Log::setFunction()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace MocOrm\Support;
4
5
/**
6
 * Implementation.
7
 */
8
class Log extends Model
9
{
10
    public function onLoad() {
11
        $this->setTableName('tb_log')
12
            ->setPrimaryKey()
13
            ->setIp()
14
            ->setSession();
15
    }
16
17
    public function setPrev($prev) {
18
        $this->prev = json_encode($prev);
0 ignored issues
show
Bug Best Practice introduced by
The property prev does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
19
20
        return $this;
21
    }
22
23
    public function getPrev() {
24
        return json_decode($this->prev);
25
    }
26
27
    public function setNext($next) {
28
        $this->next = json_encode($next);
0 ignored issues
show
Bug Best Practice introduced by
The property next does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
29
30
        return $this;
31
    }
32
33
    public function getNext() {
34
        return json_decode($this->next);
35
    }
36
37
    public function setFunction($name) {
38
        $this->function = $name;
0 ignored issues
show
Bug Best Practice introduced by
The property function does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
39
40
        return $this;
41
    }
42
43
    public function setSession() {
44
        $this->session = json_encode(@$_SESSION);
0 ignored issues
show
Bug Best Practice introduced by
The property session does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
45
46
        return $this;
47
    }
48
49
    public function setName($name) {
50
        $this->name = $name;
0 ignored issues
show
Bug Best Practice introduced by
The property name does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
51
52
        return $this;
53
    }
54
55
    public function setIp() {
56
        $this->ip = @$_SERVER['REMOTE_ADDR'];
0 ignored issues
show
Bug Best Practice introduced by
The property ip does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
57
58
        return $this;
59
    }
60
61
62
}
63