HttpProcessor   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 55.56%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 30
ccs 5
cts 9
cp 0.5556
rs 10
c 0
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 7 2
A __construct() 0 7 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 HttpProcessor
16
{
17
    /**
18
     * @var array
19
     */
20
    protected $request;
21
22
    /**
23
     * @param array $request
24
     */
25 3
    public function __construct(array $request = null)
26
    {
27 3
        if (null === $request) {
28 3
            $request = $_REQUEST;
29
        }
30
31 3
        $this->request = $request;
32 3
    }
33
34
    /**
35
     * @param array $record
36
     * @return array
37
     */
38
    public function __invoke(array $record)
39
    {
40
        if (!empty($this->request)) {
41
            $record['context']['request'] = $this->request;
42
        }
43
44
        return $record;
45
    }
46
}
47