Passed
Push — master ( 26f295...e4804f )
by Roberto
02:49
created

ReCaptchaBuilderInvisible::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Copyright (c) 2017 - present
4
 * LaravelGoogleRecaptcha - ReCaptchaBuilderInvisible.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
namespace Biscolab\ReCaptcha;
12
13
/**
14
 * Class ReCaptchaBuilderInvisible
15
 * @package Biscolab\ReCaptcha
16
 */
17
class ReCaptchaBuilderInvisible extends ReCaptchaBuilder {
18
19
    /**
20
     * ReCaptchaBuilderInvisible constructor.
21
     *
22
     * @param string $api_site_key
23
     * @param string $api_secret_key
24
     */
25
    public function __construct(string $api_site_key, string $api_secret_key) {
26
        parent::__construct($api_site_key, $api_secret_key, 'invisible');
27
    }
28
29
    /**
30
     * Write HTML <button> tag in your HTML code
31
     * Insert before </form> tag
32
     *
33
     * @param string $buttonInnerHTML
34
     *
35
     * @return string
36
     */
37
    public function htmlFormButton($buttonInnerHTML = 'Submit'): string {
38
39
        return ($this->version == 'invisible') ? '<button class="g-recaptcha" data-sitekey="' . $this->api_site_key . '" data-callback="biscolabLaravelReCaptcha">' . $buttonInnerHTML . '</button>' : '';
40
    }
41
42
}