ExceptionMessageProcessor   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 15
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 9 2
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
namespace Graze\Monolog\Processor;
14
15
class ExceptionMessageProcessor
16
{
17
    /**
18
     * @param array $record
19
     * @return array
20
     */
21
    public function __invoke(array $record)
22
    {
23
        if (isset($record['context']['exception'])) {
24
            $exception = $record['context']['exception'];
25
            $message = $record['context']['exception']->getMessage();
26
            $record['message'] = 'Uncaught ' . get_class($exception) . ': ' . $message;
27
        }
28
29
        return $record;
30
    }
31
}
32