End::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4286
cc 2
eloc 3
nc 2
nop 2
crap 2
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: arnaud
5
 * Date: 01/11/15
6
 * Time: 23:26
7
 */
8
9
namespace Ndrx\Profiler\Events\Timeline;
10
11
use Symfony\Component\EventDispatcher\Event;
12
13
class End extends Event
14
{
15
    const EVENT_NAME = 'profiler.timeline_end';
16
17
    /**
18
     * @var string
19
     */
20
    protected $key;
21
22
    /**
23
     * @var float
24
     */
25
    protected $timestamp;
26
27
    /**
28
     * End constructor.
29
     * @param string $key
30
     * @param float $timestamp
31
     */
32 4
    public function __construct($key, $timestamp = null)
33
    {
34 4
        $this->key = $key;
35 4
        $this->timestamp = $timestamp === null ? microtime(true) : $timestamp;
36 4
    }
37
38
    /**
39
     * @return string
40
     */
41 4
    public function getKey()
42
    {
43 4
        return $this->key;
44
    }
45
46
    /**
47
     * @return float
48
     */
49 4
    public function getTimestamp()
50
    {
51 4
        return $this->timestamp;
52
    }
53
54
    /**
55
     * @return array
56
     */
57 2
    public function toArray()
58
    {
59 2
        return get_object_vars($this);
60
    }
61
}
62