NormalizerFormatter::normalize()   A
last analyzed

Complexity

Conditions 4
Paths 2

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 4

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 13
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
cc 4
nc 2
nop 1
crap 4
1
<?php
2
3
namespace Norsys\LogsBundle\Formatter;
4
5
use Monolog\Formatter\NormalizerFormatter as BaseFormatter;
6
7
/**
8
 * Class NormalizerFormatter
9
 */
10
class NormalizerFormatter extends BaseFormatter
11
{
12
    /**
13
     * @param mixed $data
14
     *
15
     * @return array
16
     */
17
    protected function normalize($data)
18
    {
19 1
        $data = parent::normalize($data);
20
21 1
        if (is_array($data) === true) {
22 1
            foreach ($data as $key => &$value) {
23 1
                if (is_array($value) === true) {
24 1
                    $value = json_encode($value);
25
                }
26
            }
27
        }
28
29 1
        return $data;
30
    }
31
}
32