Passed
Push — master ( f0c8d3...7cbfe3 )
by Krisztián
05:50 queued 02:45
created

LogEntry::__toString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * All rights reserved © 2018 Legow Hosting Kft.
5
 */
6
7
namespace PhpCache\Logger;
8
9
/**
10
 * Description of LogEntry.
11
 *
12
 * @author kdudas
13
 */
14
class LogEntry
15
{
16
    const SEVERITY_INFO = 'info';
17
    const SEVERITY_NOTICE = 'notice';
18
    const SEVERITY_WARNING = 'warning';
19
    const SEVERITY_CRITICAL = 'critical';
20
21
    private $date;
22
    private $severity;
23
    private $message;
24
25
    public function __construct($date, $severity, $message)
26
    {
27
        $this->date = $date;
28
        $this->severity = $severity;
29
        $this->message = $message;
30
    }
31
32
    public function getDate()
33
    {
34
        return $this->date;
35
    }
36
37
    public function getSeverity()
38
    {
39
        return $this->severity;
40
    }
41
42
    public function getMessage()
43
    {
44
        return $this->message;
45
    }
46
47
    public function __toString()
48
    {
49
        return '['.$this->date->format('Y-m-d H:i:s')."]\t".$this->severity.': '.$this->message;
50
    }
51
}
52