Test Failed
Push — master ( 8a7ae2...79eb97 )
by Chris
06:09
created

CanBeRestrictedTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 7
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A shouldBeRendered() 0 3 2
1
<?php
2
3
namespace Leonidas\Traits;
4
5
use Leonidas\Contracts\Http\ServerRequestPolicyInterface;
6
use Psr\Http\Message\ServerRequestInterface;
7
8
trait CanBeRestrictedTrait
9
{
10
    protected ?ServerRequestPolicyInterface $policy = null;
11
12
    public function shouldBeRendered(ServerRequestInterface $request): bool
13
    {
14
        return !isset($this->policy) || $this->policy->approvesRequest($request);
0 ignored issues
show
Bug introduced by
The method approvesRequest() does not exist on null. ( Ignorable by Annotation )

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

14
        return !isset($this->policy) || $this->policy->/** @scrutinizer ignore-call */ approvesRequest($request);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
15
    }
16
}
17