LogEntry::getSeverity()   A
last analyzed

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
namespace PhpCache\Example\Logger;
4
5
/**
6
 * Description of LogEntry.
7
 *
8
 * @author kdudas
9
 */
10
class LogEntry
11
{
12
    const SEVERITY_INFO = 'info';
13
    const SEVERITY_NOTICE = 'notice';
14
    const SEVERITY_WARNING = 'warning';
15
    const SEVERITY_CRITICAL = 'critical';
16
17
    private $date;
18
    private $severity;
19
    private $message;
20
21
    public function __construct($date, $severity, $message)
22
    {
23
        $this->date = $date;
24
        $this->severity = $severity;
25
        $this->message = $message;
26
    }
27
28
    public function getDate()
29
    {
30
        return $this->date;
31
    }
32
33
    public function getSeverity()
34
    {
35
        return $this->severity;
36
    }
37
38
    public function getMessage()
39
    {
40
        return $this->message;
41
    }
42
43
    public function __toString()
44
    {
45
        return '['.$this->date->format('Y-m-d H:i:s')."]\t".$this->severity.': '.$this->message;
46
    }
47
}
48