Passed
Push — master ( ac7ac5...67fb51 )
by Roberto
03:29
created

ReCaptchaController::validateV3()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Copyright (c) 2017 - present
4
 * LaravelGoogleRecaptcha - ReCaptchaController.php
5
 * author: Roberto Belotti - [email protected]
6
 * web : robertobelotti.com, github.com/biscolab
7
 * Initial version created on: 4/2/2019
8
 * MIT license: https://github.com/biscolab/laravel-recaptcha/blob/master/LICENSE
9
 */
10
11
namespace Biscolab\ReCaptcha\Controllers;
12
13
use Illuminate\Routing\Controller;
14
15
/**
16
 * Class ReCaptchaController
17
 * @package Biscolab\ReCaptcha\Controllers
18
 */
19
class ReCaptchaController extends Controller {
20
21
	/**
22
	 * @return array
23
	 */
24
	public function validateV3(): array {
25
26
		$token = request()->input(config('recaptcha.default_token_parameter_name', 'token'), '');
27
		return recaptcha()->validate($token);
0 ignored issues
show
Bug Best Practice introduced by Roberto
The expression return recaptcha()->validate($token) could return the type boolean which is incompatible with the type-hinted return array. Consider adding an additional type-check to rule them out.
Loading history...
28
	}
29
}