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

AuthMiddleware::process()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
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