Lines
n/a
0 / 0
Methods
n/a
0 / 0
Classes
n/a
0 / 0
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __invoke | n/a | 0 / 0 | n/a | 0 / 0 | 1 | ||
| getAuthorityWithoutPassword | n/a | 0 / 0 | n/a | 0 / 0 | 1 | ||
| 12 | class LogOperatorMiddleware | |
| 13 | { | |
| 14 | public function __invoke(ServerRequestInterface $request, RequestHandlerInterface $next) | |
| 15 | { | |
| 16 | $authority = $request->getUri()->getAuthority(); | |
| 17 | \BO\Zmsbackend\Log\Service\Log::$operator = $this->getAuthorityWithoutPassword($authority) . '@' . gethostname(); | |
| 18 | ||
| 19 | return $next->handle($request); | |
| 20 | } | |
| 21 | ||
| 22 | /** | |
| 23 | * @return null|string|string[] | |
| 24 | * | |
| 25 | */ | |
| 26 | private function getAuthorityWithoutPassword(string $authority): array|string|null | |
| 27 | { | |
| 28 | $regex = '/((:)(.+)(?=@))/'; | |
| 29 | return preg_replace($regex, '', $authority); | |
| 30 | } | |
| 31 | } |