Failed Conditions
Push — master ( a26426...65249a )
by Arnold
14:53 queued 04:44
created

Guarded   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getGuardian() 0 4 1
A guard() 0 3 1
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace Jasny\Controller\Traits;
4
5
use Jasny\Controller\Guardian;
6
use Psr\Http\Message\ResponseInterface;
7
use Psr\Http\Message\ServerRequestInterface;
8
9
trait Guarded
0 ignored issues
show
Coding Style introduced by
Missing doc comment for trait Guarded
Loading history...
10
{
11
    protected Guardian $guardian;
12
13
    abstract protected function getRequest(): ServerRequestInterface;
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function getRequest()
Loading history...
14
    abstract protected function getResponse(): ResponseInterface;
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function getResponse()
Loading history...
15
16
    private function getGuardian(): Guardian
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function getGuardian()
Loading history...
Coding Style introduced by
Private method name "Guarded::getGuardian" must be prefixed with an underscore
Loading history...
17
    {
18
        $this->guardian ??= new Guardian();
19
        return $this->guardian;
20
    }
21
22
    protected function guard(\ReflectionObject|\ReflectionMethod $subject): ?ResponseInterface
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function guard()
Loading history...
23
    {
24
        return $this->getGuardian()->guard($subject, $this->getRequest(), $this->getResponse());
25
    }
26
}
27