Completed
Push — master ( 19d7ee...88c02d )
by wen
06:28
created

BaseModelEvent   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
A getContent() 0 8 1
1
<?php
2
3
4
namespace Sco\ActionLog\Events;
5
6
use Illuminate\Database\Eloquent\Model;
7
use Sco\ActionLog\Handlers\EventHandler;
8
use Sco\ActionLog\Traits\HasAttributes;
9
10
class BaseModelEvent extends AbstractEvent
11
{
12
    use HasAttributes;
13
14
    public function __construct(Model $model)
15
    {
16
        $this->setAttribute([
17
            'model.table'      => $model->getTable(),
18
            'model.original'   => $model->getOriginal(),
19
            'model.attributes' => $model->getAttributes(),
20
        ]);
21
22
        parent::__construct();
23
    }
24
25
    protected function getContent()
26
    {
27
        return [
28
            'table'      => $this->getAttribute('model.table', ''),
29
            'original'   => $this->getAttribute('model.original', []),
30
            'attributes' => $this->getAttribute('model.attributes', []),
31
        ];
32
    }
33
}
34