From 7423fb17da652b56ee76eaae8e2fda755e096d81 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Mon, 15 Jan 2024 13:15:51 +0900 Subject: [PATCH 1/2] feat: use laminas-recaptcha 3.8.0's RecaptchaServiceInterface Signed-off-by: Kent Rasmussen --- composer.json | 2 +- src/ReCaptcha.php | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index d45d23c0..bfacaed0 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "extra": {}, "require": { "php": "~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0", - "laminas/laminas-recaptcha": "^3.4.0", + "laminas/laminas-recaptcha": "^3.8.0", "laminas/laminas-session": "^2.12", "laminas/laminas-stdlib": "^3.10.1", "laminas/laminas-text": "^2.9.0", diff --git a/src/ReCaptcha.php b/src/ReCaptcha.php index 34be5d3b..f852f0ca 100644 --- a/src/ReCaptcha.php +++ b/src/ReCaptcha.php @@ -4,7 +4,7 @@ namespace Laminas\Captcha; -use Laminas\ReCaptcha\ReCaptcha as ReCaptchaService; +use Laminas\ReCaptcha\RecaptchaServiceInterface; use function array_key_exists; use function is_array; @@ -14,7 +14,7 @@ /** * ReCaptcha adapter * - * Allows to insert captchas driven by ReCaptcha service + * Allows inserting captchas driven by ReCaptcha service * * @see http://recaptcha.net/apidocs/captcha/ */ @@ -23,7 +23,7 @@ class ReCaptcha extends AbstractAdapter /** * Recaptcha service object * - * @var ReCaptchaService + * @var RecaptchaServiceInterface */ protected $service; @@ -161,7 +161,7 @@ public function setPubKey($key) */ public function __construct($options = null) { - $this->setService(new ReCaptchaService()); + $this->setService($options['service'] ?? new \Laminas\ReCaptcha\ReCaptcha()); $this->serviceParams = $this->getService()->getParams(); $this->serviceOptions = $this->getService()->getOptions(); @@ -192,7 +192,7 @@ public function __construct($options = null) * * @return ReCaptcha Provides a fluent interface */ - public function setService(ReCaptchaService $service) + public function setService(RecaptchaServiceInterface $service) { $this->service = $service; return $this; @@ -201,7 +201,7 @@ public function setService(ReCaptchaService $service) /** * Retrieve ReCaptcha service object * - * @return ReCaptchaService + * @return RecaptchaServiceInterface */ public function getService() { From 8793658d81953167125a88bb6b43be47cd8bdb8d Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Thu, 21 Mar 2024 10:38:53 +0900 Subject: [PATCH 2/2] fix: ReCaptchaServiceInterface casing --- src/ReCaptcha.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ReCaptcha.php b/src/ReCaptcha.php index f852f0ca..172ae5f6 100644 --- a/src/ReCaptcha.php +++ b/src/ReCaptcha.php @@ -4,7 +4,7 @@ namespace Laminas\Captcha; -use Laminas\ReCaptcha\RecaptchaServiceInterface; +use Laminas\ReCaptcha\ReCaptchaServiceInterface; use function array_key_exists; use function is_array; @@ -23,7 +23,7 @@ class ReCaptcha extends AbstractAdapter /** * Recaptcha service object * - * @var RecaptchaServiceInterface + * @var ReCaptchaServiceInterface */ protected $service; @@ -192,7 +192,7 @@ public function __construct($options = null) * * @return ReCaptcha Provides a fluent interface */ - public function setService(RecaptchaServiceInterface $service) + public function setService(ReCaptchaServiceInterface $service) { $this->service = $service; return $this; @@ -201,7 +201,7 @@ public function setService(RecaptchaServiceInterface $service) /** * Retrieve ReCaptcha service object * - * @return RecaptchaServiceInterface + * @return ReCaptchaServiceInterface */ public function getService() {