CanBeRestrictedTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 7
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A shouldBeRendered() 0 3 2
1
<?php
2
3
namespace Leonidas\Library\Admin\Abstracts;
4
5
use Psr\Http\Message\ServerRequestInterface;
6
use WebTheory\HttpPolicy\ServerRequestPolicyInterface;
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