Skip to content

Commit 527ca08

Browse files
authored
Merge pull request #22 from RyanDaDeng/analysis-z9BQKl
Apply fixes from StyleCI
2 parents 113bc1c + fbf4a71 commit 527ca08

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/Services/GoogleReCaptchaV3Service.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public function __construct(ReCaptchaConfigV3Interface $config, RequestClientInt
3232
public function ifInSkippedIps($ip)
3333
{
3434
$ips = $this->config->getSkipIps();
35+
3536
return in_array($ip, $ips);
3637
}
3738

@@ -42,14 +43,13 @@ public function ifInSkippedIps($ip)
4243
*/
4344
public function verifyResponse($response, $ip = null)
4445
{
45-
if (!$this->config->isServiceEnabled() || ($ip && $this->ifInSkippedIps($ip)) === true) {
46+
if (! $this->config->isServiceEnabled() || ($ip && $this->ifInSkippedIps($ip)) === true) {
4647
$res = new GoogleReCaptchaV3Response([], $ip);
4748
$res->setSuccess(true);
4849

4950
return $res;
5051
}
5152

52-
5353
if (empty($response)) {
5454
$res = new GoogleReCaptchaV3Response([], $ip, GoogleReCaptchaV3Response::MISSING_INPUT_ERROR);
5555
$res->setSuccess(false);
@@ -78,7 +78,7 @@ public function verifyResponse($response, $ip = null)
7878
return $rawResponse;
7979
}
8080

81-
if (!empty($this->config->getHostName()) && strcasecmp($this->config->getHostName(), $rawResponse->getHostname()) !== 0) {
81+
if (! empty($this->config->getHostName()) && strcasecmp($this->config->getHostName(), $rawResponse->getHostname()) !== 0) {
8282
$rawResponse->setMessage(GoogleReCaptchaV3Response::ERROR_HOSTNAME);
8383
$rawResponse->setSuccess(false);
8484

tests/ConfigTest.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,6 @@ public function testActionSkip()
221221
$this->assertEquals(true, $response->isSuccess());
222222
}
223223

224-
225-
226224
public function testIpSkip1()
227225
{
228226
// Create a stub for the SomeClass class.
@@ -244,11 +242,10 @@ public function testIpSkip1()
244242
$_service = new GoogleReCaptchaV3Service($configStub, $clientStub);
245243
$service = new GoogleReCaptchaV3($_service);
246244

247-
$response = $service->verifyResponse('test response','1.1.1.1');
245+
$response = $service->verifyResponse('test response', '1.1.1.1');
248246
$this->assertEquals(true, $response->isSuccess());
249247
}
250248

251-
252249
public function testIpSkip2()
253250
{
254251
// Create a stub for the SomeClass class.
@@ -270,7 +267,7 @@ public function testIpSkip2()
270267
$_service = new GoogleReCaptchaV3Service($configStub, $clientStub);
271268
$service = new GoogleReCaptchaV3($_service);
272269

273-
$response = $service->verifyResponse('test response','1.1.1.2');
270+
$response = $service->verifyResponse('test response', '1.1.1.2');
274271
$this->assertEquals(false, $response->isSuccess());
275272
}
276273
}

0 commit comments

Comments
 (0)