Log::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 2
Metric Value
c 2
b 0
f 2
dl 0
loc 8
ccs 7
cts 7
cp 1
rs 9.4286
cc 1
eloc 6
nc 1
nop 4
crap 1
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;
10
11
use Symfony\Component\EventDispatcher\Event;
12
13
class Log extends Event
14
{
15
    const EVENT_NAME = 'profiler.log';
16
17
    protected $level;
18
19
    protected $message;
20
21
    protected $context;
22
23
    protected $stack;
24
25
    protected $timestamp;
26
27
    /**
28
     * Log constructor.
29
     * @param $level
30
     * @param $message
31
     * @param $context
32
     * @param $stack
33
     */
34 6
    public function __construct($level, $message, $context, $stack = [])
35
    {
36 6
        $this->level = $level;
37 6
        $this->message = $message;
38 6
        $this->context = $context;
39 6
        $this->stack = $stack;
40 6
        $this->timestamp = time();
41 6
    }
42
43
    /**
44
     * @return mixed
45
     */
46 2
    public function getLevel()
47
    {
48 2
        return $this->level;
49
    }
50
51
    /**
52
     * @return mixed
53
     */
54 2
    public function getMessage()
55
    {
56 2
        return $this->message;
57
    }
58
59
    /**
60
     * @return mixed
61
     */
62 2
    public function getContext()
63
    {
64 2
        return $this->context;
65
    }
66
67
    /**
68
     * @return mixed
69
     */
70 2
    public function getStack()
71
    {
72 2
        return $this->stack;
73
    }
74
75
    /**
76
     * @return array
77
     */
78 6
    public function toArray()
79
    {
80 6
        return get_object_vars($this);
81
    }
82
}
83