Completed
Branch develop (619864)
by Michael
05:01
created

LogRecord::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 3
crap 1
1
<?php
2
3
/**
4
 * This file is part of the miBadger package.
5
 *
6
 * @author Michael Webbers <[email protected]>
7
 * @license http://opensource.org/licenses/Apache-2.0 Apache v2 License
8
 * @version 1.0.0
9
 */
10
11
namespace miBadger\Log;
12
13
/**
14
 * The log record class.
15
 *
16
 * @see http://tools.ietf.org/html/rfc5424
17
 * @since 1.0.0
18
 */
19
class LogRecord
20
{
21
	/** @var string The log records level. */
22
	private $level;
23
24
	/** @var string The log record message. */
25
	private $message;
26
27
	/** @var mixed[] The log record context. */
28
	private $context;
29
30
	/**
31
	 * Construct a log record object with the given level, message & context.
32
	 *
33
	 * @param string $level
34
	 * @param string $message
35
	 * @param mixed[] $context = []
36
	 */
37 13
	public function __construct($level, $message, array $context = [])
38
	{
39 13
		$this->level = $level;
40 13
		$this->message = $message;
41 13
		$this->context = $context;
42 13
	}
43
44
	/**
45
	 * Returns the level.
46
	 *
47
	 * @return string the level.
48
	 */
49 11
	public function getLevel()
50
	{
51 11
		return $this->level;
52
	}
53
54
	/**
55
	 * Returns the message.
56
	 *
57
	 * @return string the message.
58
	 */
59 11
	public function getMessage()
60
	{
61 11
		return $this->message;
62
	}
63
64
	/**
65
	 * Returns the context.
66
	 *
67
	 * @return mixed[] the context.
68
	 */
69 1
	public function getContext()
70
	{
71 1
		return $this->context;
72
	}
73
}
74