Passed
Pull Request — master (#7)
by
unknown
05:06
created

Occurrable   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
dl 0
loc 23
rs 10
c 1
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getOccuredProcessKey() 0 2 1
A occurred() 0 7 1
A getOccuredEntityKey() 0 2 1
1
<?php
2
3
namespace Giuga\LaravelMailLog\Traits;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
trait Occurrable {
8
9
10
11
    public static function getOccuredProcessKey() {
12
        return 'event.occurred_process';
13
    }
14
15
16
17
    public static function getOccuredEntityKey() {
18
        return 'event.occurred_entity';
19
    }
20
21
22
23
    public function occurred(Model $entity = null, Model $process = null) {
24
25
        $this->with(static::getOccuredEntityKey(), $entity);
0 ignored issues
show
Bug introduced by
It seems like with() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

25
        $this->/** @scrutinizer ignore-call */ 
26
               with(static::getOccuredEntityKey(), $entity);
Loading history...
26
27
        $this->with(static::getOccuredProcessKey(), $process);
28
29
        return $this;
30
    }
31
32
33
34
}
35