@@ 145-149 (lines=5) @@ | ||
142 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface |
|
143 | { |
|
144 | $ipstack = $this->business( $request); |
|
145 | if (false === $ipstack): |
|
146 | $m = sprintf("Could not determine client IP, force status '%s' response", $this->reponse_error_code); |
|
147 | $this->logger->log($this->invalid_ip_loglevel, $m); |
|
148 | return new GuzzleResponse( $this->reponse_error_code ); |
|
149 | endif; |
|
150 | ||
151 | $request = $request->withAttribute( $this->ipstack_attribute, $ipstack); |
|
152 | // Map certain ipstack fields to custom request attributes |
|
@@ 175-179 (lines=5) @@ | ||
172 | public function __invoke( ServerRequestInterface $request, ResponseInterface $response, callable $next ) |
|
173 | { |
|
174 | $ipstack = $this->business( $request); |
|
175 | if (false === $ipstack): |
|
176 | $m = sprintf("Could not determine client IP, force status '%s' response", $this->reponse_error_code); |
|
177 | $this->logger->log($this->invalid_ip_loglevel, $m); |
|
178 | return $response->withStatus( $this->reponse_error_code ); |
|
179 | endif; |
|
180 | ||
181 | $request = $request->withAttribute( $this->ipstack_attribute, $ipstack); |
|
182 | // Map certain ipstack fields to custom request attributes |