client = $client; } public function handle(\WP_REST_Request $request, callable $next) { if (!$this->client->hasAuthentication()) { return $this->sendHttpErrorResponse( __('Unauthorized. Please log-in into the Metricool plugin.', 'metricool'), null, 401 ); } return $next($request); } }