Completed
Push — master ( f8d4b2...9b5d9d )
by Márk
10s
created

CommonInfoCollector   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 21
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 15 2
1
<?php
2
3
namespace Nofw\Emperror\Processor;
4
5
use Nofw\Emperror\Processor;
6
use Nofw\Error\Context;
7
8
/**
9
 * Collects common application info about the host.
10
 *
11
 * @author Márk Sági-Kazár <[email protected]>
12
 */
13
final class CommonInfoCollector implements Processor
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18
    public function process(\Throwable $t, array $context): array
19
    {
20
        $common = [
21
            Context::APP => [
22
                'os' => php_uname(),
23
                'language' => 'PHP '.phpversion(),
24
            ],
25
        ];
26
27
        if (($hostname = gethostname()) !== false) {
28
            $common[Context::APP]['hostname'] = $hostname;
29
        }
30
31
        return array_replace_recursive($common, $context);
32
    }
33
}
34