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

ReCaptchaBuilderInvisible   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A htmlFormButton() 0 3 2
A __construct() 0 2 1
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
}