FailHook   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 2
eloc 5
c 2
b 1
f 0
dl 0
loc 10
ccs 5
cts 5
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A failHook() 0 8 2
1
<?php
2
3
namespace Larapie\Actions\Concerns;
4
5
use Throwable;
6
7
trait FailHook
8
{
9 6
    protected function failHook(Throwable $exception)
10
    {
11 6
        if (! method_exists($this, 'onFail')) {
12 3
            throw $exception;
13
        }
14 3
        $this->resolveAndCall($this, 'onFail', compact('exception'));
0 ignored issues
show
Bug introduced by
It seems like resolveAndCall() 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

14
        $this->/** @scrutinizer ignore-call */ 
15
               resolveAndCall($this, 'onFail', compact('exception'));
Loading history...
15
16 1
        throw $exception;
17
    }
18
}
19