Completed
Pull Request — master (#1)
by Timothy
04:50
created

DefaultFormatter::format()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 9
rs 9.6666
cc 2
eloc 4
nc 2
nop 3
1
<?php
2
3
namespace Abacaphiliac\PsrLog4Php;
4
5
class DefaultFormatter implements FormatterInterface
6
{
7
    /**
8
     * @param mixed $level
9
     * @param mixed $message
10
     * @param mixed[] $context
11
     * @return mixed
12
     */
13
    public function format($level, $message, array $context = array())
14
    {
15
        if (is_string($message)) {
16
            return $message . ' ' . json_encode($context);
17
        }
18
19
        // Cannot append encoded context without causing an error, or blocking log4php object renderers.
20
        return $message;
21
    }
22
}
23