/**
  * IP Restriction Middleware call.
  *
  * @param \Psr\Http\Message\ServerRequestInterface $request 
  *   PSR7 request
  * @param \Psr\Http\Message\ResponseInterface $response
  *   PSR7 response
  * @param callable $next 
  *   Next middleware
  *
  * @return \Psr\Http\Message\ResponseInterface
  */
 public function __invoke(ServerRequestInterface $request, ResponseInterface $response, $next)
 {
     // Get client's IP.
     $ip = $request->getIp();
     // Get the Content-Type set in the Request's Accept header.
     $contentType = $this->determineContentType($request->getHeaderLine('Accept'));
     // Desired status code to send.
     $statusCode = $this->setStatusCode($this->options);
     // Exception Message to send.
     $message = $this->setExceptionMessage($contentType, $this->options);
     // Restrict The IP access if needed.
     $restrict = $this->restrict($ip, $this->allowList, !$this->negate);
     if ($restrict === true) {
         return $response->withStatus($statusCode)->withHeader('Content-type', $contentType)->write($message);
     } else {
         // Proceed with the application access.
         return $response = $next($request, $response);
     }
 }