Passed
Pull Request — master (#98)
by
unknown
02:54
created

AuditEntry::getUserId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 2
b 0
f 0
1
<?php
2
3
namespace DH\DoctrineAuditBundle;
4
5
class AuditEntry
6
{
7
    /**
8
     * @var int
9
     */
10
    protected $id;
11
    /**
12
     * @var string
13
     */
14
    protected $type;
15
    /**
16
     * @var int
17
     */
18
    protected $object_id;
19
    /**
20
     * @var string
21
     */
22
    protected $diffs;
23
    /**
24
     * @var int
25
     */
26
    protected $blame_id;
27
    /**
28
     * @var string
29
     */
30
    protected $blame_user;
31
    /**
32
     * @var string
33
     */
34
    protected $ip;
35
    /**
36
     * @var string
37
     */
38
    protected $created_at;
39
40
    public function __set($name, $value)
41
    {
42
        $this->{$name} = $value;
43
    }
44
45
    /**
46
     * Get the value of id.
47
     *
48
     * @return int
49
     */
50
    public function getId(): int
51
    {
52
        return $this->id;
53
    }
54
55
    /**
56
     * Get the value of type.
57
     *
58
     * @return string
59
     */
60
    public function getType(): string
61
    {
62
        return $this->type;
63
    }
64
65
    /**
66
     * Get the value of object_id.
67
     *
68
     * @return int
69
     */
70
    public function getObjectId(): ?int
71
    {
72
        return $this->object_id;
73
    }
74
75
    /**
76
     * Get the value of blame_id.
77
     *
78
     * @return int|string
79
     */
80
    public function getUserId()
81
    {
82
        return $this->blame_id ?? 'Unknown';
83
    }
84
85
    /**
86
     * Get the value of blame_user.
87
     *
88
     * @return string
89
     */
90
    public function getUsername(): string
91
    {
92
        return $this->blame_user ?? 'Unknown';
93
    }
94
95
    /**
96
     * Get the value of ip.
97
     *
98
     * @return string
99
     */
100
    public function getIp(): ?string
101
    {
102
        return $this->ip;
103
    }
104
105
    /**
106
     * Get the value of created_at.
107
     *
108
     * @return string
109
     */
110
    public function getCreatedAt(): string
111
    {
112
        return $this->created_at;
113
    }
114
115
    /**
116
     * Get the value of created_at.
117
     *
118
     * @return array
119
     */
120
    public function getDiffs(): ?array
121
    {
122
        return json_decode($this->diffs, true);
123
    }
124
}
125