Completed
Push — master ( 7b9b82...f4954a )
by Roberto
07:53 queued 11s
created

htmlScriptTagJsApiV3()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 2
b 0
f 1
nc 1
nop 1
dl 0
loc 4
rs 10
ccs 1
cts 1
cp 1
crap 1
1
<?php
2
/**
3
 * Copyright (c) 2017 - present
4
 * LaravelGoogleRecaptcha - helpers.php
5
 * author: Roberto Belotti - [email protected]
6
 * web : robertobelotti.com, github.com/biscolab
7
 * Initial version created on: 12/9/2018
8
 * MIT license: https://github.com/biscolab/laravel-recaptcha/blob/master/LICENSE
9
 */
10
11
use Biscolab\ReCaptcha\Facades\ReCaptcha;
12
13
if (!function_exists('recaptcha')) {
14
	/**
15
	 * @return Biscolab\ReCaptcha\ReCaptchaBuilder
16
	 */
17
	function recaptcha()
18
	{
19
20 1
		return app('recaptcha');
0 ignored issues
show
Bug Best Practice introduced by
The expression return app('recaptcha') also could return the type Illuminate\Contracts\Foundation\Application which is incompatible with the documented return type Biscolab\ReCaptcha\ReCaptchaBuilder.
Loading history...
21
	}
22
}
23
24
/**
25
 * call ReCaptcha::htmlScriptTagJsApi()
26
 * Write script HTML tag in you HTML code
27
 * Insert before </head> tag
28
 *
29
 * @param $formId required if you are using invisible ReCaptcha
30
 */
31
if (!function_exists('htmlScriptTagJsApi')) {
32
33
	/**
34
	 * @param string $formId
35
	 *
36
	 * @return string
37
	 */
38
	function htmlScriptTagJsApi($formId = ''): string
39
	{
40
41 2
		return ReCaptcha::htmlScriptTagJsApi($formId);
42
	}
43
}
44
45
/**
46
 * call ReCaptcha::htmlScriptTagJsApi()
47
 * Write script HTML tag in you HTML code
48
 * Insert before </head> tag
49
 *
50
 * @param $formId required if you are using invisible ReCaptcha
51
 */
52
if (!function_exists('htmlScriptTagJsApiV3')) {
53
54
	/**
55
	 * @param array $config
56
	 *
57
	 * @return string
58
	 */
59
	function htmlScriptTagJsApiV3($config = []): string
60
	{
61
62 2
		return ReCaptcha::htmlScriptTagJsApiV3($config);
63
	}
64
}
65
66
/**
67
 * call ReCaptcha::htmlFormButton()
68
 * Write HTML <button> tag in your HTML code
69
 * Insert before </form> tag
70
 *
71
 * Warning! Using only with ReCAPTCHA INVISIBLE
72
 *
73
 * @param $buttonInnerHTML What you want to write on the submit button
74
 */
75
if (!function_exists('htmlFormButton')) {
76
77
	/**
78
	 * @param null|string $buttonInnerHTML
79
	 *
80
	 * @return string
81
	 */
82
	function htmlFormButton(?string $buttonInnerHTML = 'Submit'): string
83
	{
84
85 2
		return ReCaptcha::htmlFormButton($buttonInnerHTML);
86
	}
87
}
88
89
/**
90
 * call ReCaptcha::htmlFormSnippet()
91
 * Write ReCAPTCHA HTML tag in your FORM
92
 * Insert before </form> tag
93
 *
94
 * Warning! Using only with ReCAPTCHA v2
95
 */
96
if (!function_exists('htmlFormSnippet')) {
97
98
	/**
99
	 * @return string
100
	 */
101
	function htmlFormSnippet(): string
102
	{
103
104 2
		return ReCaptcha::htmlFormSnippet();
105
	}
106
}
107
108