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

Occurrable::occurred()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 7
rs 10
c 1
b 0
f 0
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