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

AbstractHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getClient() 0 19 2
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