From 48accc23e40983d7b3e4dbf0ecd654434aeb65d6 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Mon, 28 Nov 2022 23:03:58 +0700 Subject: [PATCH] refactor: following rector changes --- src/Recaptcha.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Recaptcha.php b/src/Recaptcha.php index e7232e5..a19da00 100644 --- a/src/Recaptcha.php +++ b/src/Recaptcha.php @@ -38,7 +38,7 @@ public function __construct(RecaptchaConfig $config) */ protected function _submitHTTPGet(array $data = []) { - $url = count($data) > 0 ? self::site_verify_url . '?' . http_build_query($data) : self::site_verify_url; + $url = $data !== [] ? self::site_verify_url . '?' . http_build_query($data) : self::site_verify_url; if (ini_get('allow_url_fopen')) { return file_get_contents($url); @@ -94,12 +94,12 @@ public function verifyResponse($response, $remoteIp = null) $status = true; } else { $status = false; - $error = (isset($responses['error-codes'])) ? $responses['error-codes'] : 'invalid-input-response'; + $error = $responses['error-codes'] ?? 'invalid-input-response'; } return [ 'success' => $status, - 'error-codes' => (isset($error)) ? $error : null, + 'error-codes' => $error ?? null, ]; } @@ -120,7 +120,7 @@ public function getScriptTag(array $parameters = []) 'hl' => $this->config->recaptchaLang, ]; - $result = count($parameters) > 0 ? array_merge($default, $parameters) : $default; + $result = $parameters !== [] ? array_merge($default, $parameters) : $default; return sprintf( '', @@ -146,7 +146,7 @@ public function getWidget(array $parameters = []) 'data-size' => 'normal', ]; - $result = count($parameters) > 0 ? array_merge($default, $parameters) : $default; + $result = $parameters !== [] ? array_merge($default, $parameters) : $default; $countedResult = count($result); $html = '';