Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
LogOperatorMiddleware | n/a |
0 / 0 |
n/a |
0 / 0 |
2 | n/a |
0 / 0 |
|||
__invoke | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
getAuthorityWithoutPassword | n/a |
0 / 0 |
n/a |
0 / 0 |
1 |
1 | <?php |
2 | |
3 | namespace BO\Zmsapi\Helper; |
4 | |
5 | use Psr\Http\Message\ServerRequestInterface; |
6 | use Psr\Http\Server\RequestHandlerInterface; |
7 | |
8 | /** |
9 | * @codeCoverageIgnore |
10 | * |
11 | */ |
12 | class LogOperatorMiddleware |
13 | { |
14 | public function __invoke(ServerRequestInterface $request, RequestHandlerInterface $next) |
15 | { |
16 | $authority = $request->getUri()->getAuthority(); |
17 | \BO\Zmsdb\Log::$operator = $this->getAuthorityWithoutPassword($authority) . '@' . gethostname(); |
18 | |
19 | return $next->handle($request); |
20 | } |
21 | |
22 | private function getAuthorityWithoutPassword($authority) |
23 | { |
24 | $regex = '/((:)(.+)(?=@))/'; |
25 | return preg_replace($regex, '', $authority); |
26 | } |
27 | } |