LogEntry   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 36
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getDate() 0 3 1
A getSeverity() 0 3 1
A getMessage() 0 3 1
A __construct() 0 5 1
A __toString() 0 3 1
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