Completed
Push — master ( 3f2c58...3eb51e )
by wen
02:00
created

AbstractHandler::getClient()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 19
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 19
rs 9.4285
cc 2
eloc 11
nc 2
nop 0
1
<?php
2
3
4
namespace Sco\ActionLog\Handlers;
5
6
7
abstract class AbstractHandler implements HandlerInterface
8
{
9
    protected function getClient()
10
    {
11
        if (class_exists('\Jenssegers\Agent\Agent')) {
12
            $agent = new \Jenssegers\Agent\Agent();
13
14
            $platform = $agent->platform();
15
            $browser  = $agent->browser();
16
17
            return [
18
                'device'   => $agent->device(),
19
                'platform' => $platform . ' ' . $agent->version($platform),
20
                'browser'  => $browser . ' ' . $agent->version($browser),
21
            ];
22
        }
23
24
        return [
25
            'agent' => request()->server('HTTP_USER_AGENT'),
26
        ];
27
    }
28
}
29