Total Complexity | 8 |
Total Lines | 79 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
21 | class Message |
||
22 | { |
||
23 | /** |
||
24 | * Message body |
||
25 | * |
||
26 | * @var string |
||
27 | */ |
||
28 | public $body; |
||
29 | |||
30 | /** |
||
31 | * Message type |
||
32 | * |
||
33 | * @var string info|succes|warning|danger|mail |
||
34 | */ |
||
35 | public $type; |
||
36 | |||
37 | /** |
||
38 | * |
||
39 | * @var \Ease\Atom |
||
40 | */ |
||
41 | public $caller; |
||
42 | |||
43 | /** |
||
44 | * Message Timestamp |
||
45 | * |
||
46 | * @var int |
||
47 | */ |
||
48 | public $when; |
||
49 | |||
50 | /** |
||
51 | * Basic Message class |
||
52 | * |
||
53 | * @param string $message text |
||
54 | * @param string $type One of info|notice|debug|error |
||
55 | 2 | * @param \Ease\Atom $caller Origin of message |
|
56 | * @param int $when Timestamp |
||
57 | */ |
||
58 | 2 | public function __construct($message, $type = 'info', $caller = null, |
|
59 | 2 | $when = null |
|
60 | 2 | ) { |
|
61 | 2 | $this->body = $message; |
|
62 | 2 | $this->type = $type; |
|
63 | $this->caller = $caller; |
||
64 | 1 | if (is_null($when)) { |
|
65 | $this->when = time(); |
||
66 | 2 | } else { |
|
67 | $this->when = $when; |
||
68 | } |
||
69 | } |
||
70 | |||
71 | /** |
||
72 | * Unicode Symbol for given message type |
||
73 | * |
||
74 | 1 | * @param string $type |
|
75 | * @return string |
||
76 | */ |
||
77 | 1 | public static function getTypeUnicodeSymbol($type) |
|
100 | } |
||
101 | } |
||
102 |