http = $http; $this->secret = $secret; } public function responseField(): string { return 'smart-captcha'; } public function verify(string $response, ?string $remote_ip): bool { $data = [ 'secret' => $this->secret, 'token' => $response ]; if ($remote_ip !== null) { $data['ip'] = $remote_ip; } $ret = $this->http->requestGet('https://smartcaptcha.yandexcloud.net/validate', $data); $resp = json_decode($ret, true, 16, JSON_THROW_ON_ERROR); return isset($resp['status']) && $resp['status'] === 'ok'; } }