Completed
Push — master ( 621b28...d1b6c4 )
by Alessandro
02:42
created

LogEvent::setStart()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Facile\MongoDbBundle\Models;
6
7
/**
8
 * Class LogEvent.
9
 */
10
class LogEvent
11
{
12
    /** @var float */
13
    private $start;
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
    /**
28
     * LogEvent constructor.
29
     */
30 13
    public function __construct()
31
    {
32 13
        $this->start = 0.0;
33 13
        $this->collection = 'undefined';
34 13
        $this->method = 'undefined';
35 13
        $this->data = [];
36 13
        $this->executionTime = 0;
37 13
    }
38
39
    /**
40
     * @return float
41
     */
42 3
    public function getStart(): float
43
    {
44 3
        return $this->start;
45
    }
46
47
    /**
48
     * @param float $start
49
     */
50 1
    public function setStart(float $start)
51
    {
52 1
        $this->start = $start;
53 1
    }
54
55
    /**
56
     * @return string
57
     */
58 1
    public function getCollection(): string
59
    {
60 1
        return $this->collection;
61
    }
62
63
    /**
64
     * @param string $collection
65
     */
66 10
    public function setCollection(string $collection)
67
    {
68 10
        $this->collection = $collection;
69 10
    }
70
71
    /**
72
     * @return string
73
     */
74 1
    public function getMethod(): string
75
    {
76 1
        return $this->method;
77
    }
78
79
    /**
80
     * @param string $method
81
     */
82 9
    public function setMethod(string $method)
83
    {
84 9
        $this->method = $method;
85 9
    }
86
87
    /**
88
     * @return array
89
     */
90 1
    public function getData(): array
91
    {
92 1
        return $this->data;
93
    }
94
95
    /**
96
     * @param array $data
97
     */
98 10
    public function setData(array $data)
99
    {
100 10
        $this->data = $data;
101 10
    }
102
103
    /**
104
     * @return float
105
     */
106 3
    public function getExecutionTime(): float
107
    {
108 3
        return $this->executionTime;
109
    }
110
111
    /**
112
     * @param float $executionTime
113
     */
114 3
    public function setExecutionTime(float $executionTime)
115
    {
116 3
        $this->executionTime = $executionTime;
0 ignored issues
show
Documentation Bug introduced by
The property $executionTime was declared of type integer, but $executionTime is of type double. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
117 3
    }
118
}
119