Passed
Pull Request — master (#5)
by Damien
03:34
created

Entry::__set()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
dl 0
loc 3
c 1
b 0
f 0
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
namespace DH\Auditor\Model;
4
5
class Entry
6
{
7
    /**
8
     * @var int
9
     */
10
    protected $id;
11
12
    /**
13
     * @var string
14
     */
15
    protected $type;
16
17
    /**
18
     * @var string
19
     */
20
    protected $object_id;
21
22
    /**
23
     * @var null|string
24
     */
25
    protected $discriminator;
26
27
    /**
28
     * @var null|string
29
     */
30
    protected $transaction_hash;
31
32
    /**
33
     * @var string
34
     */
35
    protected $diffs;
36
37
    /**
38
     * @var null|int|string
39
     */
40
    protected $blame_id;
41
42
    /**
43
     * @var string
44
     */
45
    protected $blame_user;
46
47
    /**
48
     * @var string
49
     */
50
    protected $blame_user_fqdn;
51
52
    /**
53
     * @var string
54
     */
55
    protected $blame_user_firewall;
56
57
    /**
58
     * @var string
59
     */
60
    protected $ip;
61
62
    /**
63
     * @var string
64
     */
65
    protected $created_at;
66
67
    /**
68
     * Get the value of id.
69
     */
70
    public function getId(): int
71
    {
72
        return $this->id;
73
    }
74
75
    /**
76
     * Get the value of type.
77
     */
78
    public function getType(): string
79
    {
80
        return $this->type;
81
    }
82
83
    /**
84
     * Get the value of object_id.
85
     */
86
    public function getObjectId(): string
87
    {
88
        return $this->object_id;
89
    }
90
91
    /**
92
     * Get the value of discriminator.
93
     */
94
    public function getDiscriminator(): ?string
95
    {
96
        return $this->discriminator;
97
    }
98
99
    /**
100
     * Get the value of transaction_hash.
101
     */
102
    public function getTransactionHash(): ?string
103
    {
104
        return $this->transaction_hash;
105
    }
106
107
    /**
108
     * Get the value of blame_id.
109
     *
110
     * @return null|int|string
111
     */
112
    public function getUserId()
113
    {
114
        return $this->blame_id;
115
    }
116
117
    /**
118
     * Get the value of blame_user.
119
     */
120
    public function getUsername(): ?string
121
    {
122
        return $this->blame_user;
123
    }
124
125
    public function getUserFqdn(): ?string
126
    {
127
        return $this->blame_user_fqdn;
128
    }
129
130
    public function getUserFirewall(): ?string
131
    {
132
        return $this->blame_user_firewall;
133
    }
134
135
    /**
136
     * Get the value of ip.
137
     *
138
     * @return string
139
     */
140
    public function getIp(): ?string
141
    {
142
        return $this->ip;
143
    }
144
145
    /**
146
     * Get the value of created_at.
147
     */
148
    public function getCreatedAt(): string
149
    {
150
        return $this->created_at;
151
    }
152
153
    /**
154
     * Get the value of created_at.
155
     *
156
     * @return array
157
     */
158
    public function getDiffs(): ?array
159
    {
160
        return $this->sort(json_decode($this->diffs, true));
161
    }
162
163
    private function sort(array $array): array
164
    {
165
        ksort($array);
166
        foreach ($array as $key => $value) {
167
            if (\is_array($value)) {
168
                $array[$key] = $this->sort($value);
169
            }
170
        }
171
172
        return $array;
173
    }
174
}
175