JsonDateAwareFormatter::format()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/*
3
 * This file is part of Monolog Extensions
4
 *
5
 * Copyright (c) 2014 Nature Delivered Ltd. <http://graze.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @see  http://github.com/graze/MonologExtensions/blob/master/LICENSE
11
 * @link http://github.com/graze/MonologExtensions
12
 */
13
14
namespace Graze\Monolog\Formatter;
15
16
use Monolog\Formatter\NormalizerFormatter;
17
18
class JsonDateAwareFormatter extends NormalizerFormatter
19
{
20
    /**
21
     * {@inheritdoc}
22
     *
23
     * @param  array $record A record to format
24
     *
25
     * @return mixed The formatted record
26
     */
27 3
    public function format(array $record)
28
    {
29 3
        $data = parent::format($record);
30 3
        return $this->toJson($data, true);
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     *
36
     * @param  array $records A set of records to format
37
     *
38
     * @return mixed The formatted set of records
39
     */
40 1
    public function formatBatch(array $records)
41
    {
42 1
        return $this->format($records);
43
    }
44
}
45