Completed
Push — master ( 11ef10...599dfd )
by Владислав
02:13
created

AnticaptchaReCaptchaProxeless::recognize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
3
namespace jumper423\decaptcha\services;
4
5
/**
6
 * Class AnticaptchaReCaptchaProxeless.
7
 */
8
class AnticaptchaReCaptchaProxeless extends Anticaptcha
9
{
10
    public function init()
11
    {
12
        parent::init();
13
14
        unset(
15
            $this->paramsNames[self::ACTION_FIELD_FILE],
16
            $this->paramsNames[self::ACTION_FIELD_PHRASE],
17
            $this->paramsNames[self::ACTION_FIELD_PINGBACK],
18
            $this->paramsNames[self::ACTION_FIELD_REGSENSE],
19
            $this->paramsNames[self::ACTION_FIELD_NUMERIC],
20
            $this->paramsNames[self::ACTION_FIELD_CALC],
21
            $this->paramsNames[self::ACTION_FIELD_MIN_LEN],
22
            $this->paramsNames[self::ACTION_FIELD_MAX_LEN],
23
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][self::ACTION_FIELD_FILE],
24
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][self::ACTION_FIELD_PHRASE],
25
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][self::ACTION_FIELD_PINGBACK],
26
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][self::ACTION_FIELD_REGSENSE],
27
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][self::ACTION_FIELD_NUMERIC],
28
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][self::ACTION_FIELD_CALC],
29
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][self::ACTION_FIELD_MIN_LEN],
30
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][self::ACTION_FIELD_MAX_LEN]
31
        );
32
33
        $this->paramsNames[static::ACTION_FIELD_PAGEURL] = 'websiteURL';
34
        $this->paramsNames[static::ACTION_FIELD_GOOGLEKEY] = 'websiteKey';
35
        $this->paramsNames[static::ACTION_FIELD_GOOGLETOKEN] = 'websiteSToken';
36
37
        $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELD_TASK][static::ACTION_FIELDS] = [
38
            static::ACTION_FIELD_METHOD => [
39
                static::PARAM_SLUG_DEFAULT => 'NoCaptchaTask',
40
                static::PARAM_SLUG_REQUIRE => true,
41
                static::PARAM_SLUG_TYPE    => static::PARAM_FIELD_TYPE_STRING,
42
            ],
43
            static::ACTION_FIELD_PAGEURL => [
44
                static::PARAM_SLUG_REQUIRE => true,
45
                static::PARAM_SLUG_TYPE    => static::PARAM_FIELD_TYPE_STRING,
46
            ],
47
            static::ACTION_FIELD_GOOGLEKEY => [
48
                static::PARAM_SLUG_REQUIRE => true,
49
                static::PARAM_SLUG_TYPE    => static::PARAM_FIELD_TYPE_STRING,
50
            ],
51
            static::ACTION_FIELD_GOOGLETOKEN => [
52
                static::PARAM_SLUG_TYPE => static::PARAM_FIELD_TYPE_STRING,
53
            ],
54
        ];
55
56
        $this->decodeSettings[static::DECODE_ACTION][static::DECODE_ACTION_GET][static::DECODE_PARAMS][static::DECODE_PARAM_CODE][static::DECODE_PARAM_SETTING_MARKER] = 'solution.gRecaptchaResponse';
57
    }
58
59
    public function recognize($additionally = [], $null = null)
60
    {
61
        return parent::recognize(null, $additionally);
62
    }
63
}
64