BaseModelEvent   A
last analyzed

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\Attributes\HasAttributesTrait;
8
9
class BaseModelEvent extends Event
10
{
11
    use HasAttributesTrait;
12
13
    public function __construct(Model $model)
14
    {
15
        $this->setAttribute([
16
            'model.table'      => $model->getTable(),
17
            'model.original'   => $model->getOriginal(),
18
            'model.attributes' => $model->getAttributes(),
19
        ]);
20
21
        parent::__construct();
22
    }
23
24
    protected function getContent()
25
    {
26
        return [
27
            'table'      => $this->getAttribute('model.table', ''),
28
            'original'   => $this->getAttribute('model.original', []),
29
            'attributes' => $this->getAttribute('model.attributes', []),
30
        ];
31
    }
32
}
33