/** * @param \Cake\Http\ServerRequest $request The request. * @param \Cake\Network\Response $response The response. * @param callable $next The next middleware to call. * @return \Psr\Http\Message\ResponseInterface A response. */ public function __invoke(ServerRequestInterface $request, ResponseInterface $response, $next) { $ip = $request->clientIp(); $Maintenance = new Maintenance(); if (!$Maintenance->isMaintenanceMode($ip)) { return $next($request, $response); } $response = $this->build($response); return $response; }