Completed
Push — master ( 55d0bf...bd8278 )
by Andrii
15:19
created

AuthMiddleware   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 14
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A process() 0 6 1
authenticate() 0 1 ?
1
<?php
2
3
namespace hiapi\Core\Auth;
4
5
use Psr\Http\Message\ResponseInterface;
6
use Psr\Http\Message\ServerRequestInterface;
7
use Psr\Http\Server\MiddlewareInterface;
8
use Psr\Http\Server\RequestHandlerInterface;
9
10
abstract class AuthMiddleware implements MiddlewareInterface
11
{
12
    /**
13
     * @inheritDoc
14
     */
15
    public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
16
    {
17
        $this->authenticate($request);
18
19
        return $handler->handle($request);
20
    }
21
22
    abstract public function authenticate(ServerRequestInterface $request);
23
}
24