Trace   A
last analyzed

Complexity

Total Complexity 15

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 15
eloc 27
c 2
b 0
f 1
dl 0
loc 71
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A tableName() 0 6 2
A isDelete() 0 7 2
A isSelect() 0 7 2
A tablePk() 0 6 2
A queryCode() 0 3 1
A operatorId() 0 6 2
A isInsert() 0 7 2
A isUpdate() 0 7 2
1
<?php
2
3
namespace HexMakina\Tracer;
4
5
class Trace implements \HexMakina\BlackBox\Database\TraceInterface
6
{
7
    private string $query_type;
8
    private string $query_table;
9
    private string $query_id;
10
    private string $query_by;
11
12
    public function isUpdate(bool $setter = null) : bool
13
    {
14
        if (is_bool($setter)) {
15
            $this->query_type = self::CODE_UPDATE;
16
        }
17
18
        return $this->query_type === self::CODE_UPDATE;
19
    }
20
21
    public function isDelete(bool $setter = null) : bool
22
    {
23
        if (is_bool($setter)) {
24
            $this->query_type = self::CODE_DELETE;
25
        }
26
27
        return $this->query_type === self::CODE_DELETE;
28
    }
29
30
    public function isInsert(bool $setter = null) : bool
31
    {
32
        if (is_bool($setter)) {
33
            $this->query_type = self::CODE_CREATE;
34
        }
35
36
        return $this->query_type === self::CODE_CREATE;
37
    }
38
39
    public function isSelect(bool $setter = null) : bool
40
    {
41
        if (is_bool($setter)) {
42
            $this->query_type = self::CODE_SELECT;
43
        }
44
45
        return $this->query_type === self::CODE_SELECT;
46
    }
47
48
49
    public function queryCode() : string
50
    {
51
        return $this->query_type;
52
    }
53
54
    public function tableName(string $setter = null) : string
55
    {
56
        if ($setter !== null) {
57
            $this->query_table = $setter;
58
        }
59
        return $this->query_table;
60
    }
61
62
    public function tablePk(string $setter = null) : string
63
    {
64
        if ($setter !== null) {
65
            $this->query_id = $setter;
66
        }
67
        return $this->query_id;
68
    }
69
70
    public function operatorId(string $setter = null) : string
71
    {
72
        if ($setter !== null) {
73
            $this->query_by = $setter;
74
        }
75
        return $this->query_by;
76
    }
77
}
78