Completed
Pull Request — master (#8)
by Alessandro
08:00
created

LogEvent   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 117
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 12
c 0
b 0
f 0
lcom 1
cbo 0
dl 0
loc 117
ccs 28
cts 28
cp 1
rs 10

12 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A getWatchKey() 0 4 1
A setWatchKey() 0 4 1
A getCollection() 0 4 1
A setCollection() 0 4 1
A getMethod() 0 4 1
A setMethod() 0 4 1
A getData() 0 4 1
A getDataJson() 0 4 1
A setData() 0 4 1
A getExecutionTime() 0 4 1
A setExecutionTime() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Facile\MongoDbBundle\Services\Loggers\Model;
6
7
/**
8
 * Class LogEvent.
9
 */
10
class LogEvent
11
{
12
    /** @var string */
13
    private $watchKey;
14
15
    /** @var string */
16
    private $method;
17
18
    /** @var string */
19
    private $collection;
20
21
    /** @var array */
22
    private $data;
23
24
    /** @var int */
25
    private $executionTime;
26
27 4
    /**
28
     * LogEvent constructor.
29 4
     */
30 4
    public function __construct()
31 4
    {
32 4
        $this->watchKey = '';
33 4
        $this->collection = 'undefined';
34
        $this->method = 'undefined';
35
        $this->data = [];
36
        $this->executionTime = 0;
37
    }
38 1
39
    /**
40 1
     * @return string
41
     */
42
    public function getWatchKey(): string
43
    {
44
        return $this->watchKey;
45
    }
46 2
47
    /**
48 2
     * @param string $watchKey
49 2
     */
50
    public function setWatchKey(string $watchKey)
51
    {
52
        $this->watchKey = $watchKey;
53
    }
54 1
55
    /**
56 1
     * @return string
57
     */
58
    public function getCollection(): string
59
    {
60
        return $this->collection;
61
    }
62 1
63
    /**
64 1
     * @param string $collection
65 1
     */
66
    public function setCollection(string $collection)
67
    {
68
        $this->collection = $collection;
69
    }
70 1
71
    /**
72 1
     * @return string
73
     */
74
    public function getMethod(): string
75
    {
76
        return $this->method;
77
    }
78 1
79
    /**
80 1
     * @param string $method
81
     */
82
    public function setMethod(string $method)
83
    {
84
        $this->method = $method;
85
    }
86 1
87
    /**
88 1
     * @return array
89 1
     */
90
    public function getData(): array
91
    {
92
        return $this->data;
93
    }
94 3
95
    /**
96 3
     * @return string
97
     */
98
    public function getDataJson(): string
99
    {
100
        return json_encode($this->data);
101
    }
102 3
103
    /**
104 3
     * @param array $data
105 3
     */
106
    public function setData(array $data)
107
    {
108
        $this->data = $data;
109
    }
110
111
    /**
112
     * @return int
113
     */
114
    public function getExecutionTime(): int
115
    {
116
        return $this->executionTime;
117
    }
118
119
    /**
120
     * @param int $executionTime
121
     */
122
    public function setExecutionTime(int $executionTime)
123
    {
124
        $this->executionTime = $executionTime;
125
    }
126
}
127
128