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

WebHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A info() 0 11 1
1
<?php
2
3
4
namespace Sco\ActionLog\Handlers;
5
6
use Sco\ActionLog\LogInfo;
7
use Sco\ActionLog\Traits\HasAttributes;
8
9
class WebHandler extends AbstractHandler
10
{
11
    use HasAttributes;
12
13
    public function __construct(array $attributes)
14
    {
15
        $this->setAttribute($attributes);
16
    }
17
18
    public function info()
19
    {
20
        return new LogInfo([
21
            'type'       => $this->getAttribute('type', 'web'),
22
            'table_name' => $this->getAttribute('table_name', ''),
23
            'content'    => $this->getAttribute('content', ''),
24
            'client_ip'  => request()->getClientIp(),
25
            'client'     => $this->getClient(),
26
            'user_id'    => intval(Auth::id()),
27
        ]);
28
    }
29
}
30