Completed
Push — master ( 7f2995...4556a8 )
by Владислав
02:13
created

AnticaptchaReCaptchaProxeless::init()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 44
Code Lines 34

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 1 Features 0
Metric Value
dl 0
loc 44
rs 8.8571
c 3
b 1
f 0
cc 1
eloc 34
nc 1
nop 0
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[static::ACTION_FIELD_FILE],
16
            $this->paramsNames[static::ACTION_FIELD_PHRASE],
17
            $this->paramsNames[static::ACTION_FIELD_PINGBACK],
18
            $this->paramsNames[static::ACTION_FIELD_REGSENSE],
19
            $this->paramsNames[static::ACTION_FIELD_NUMERIC],
20
            $this->paramsNames[static::ACTION_FIELD_CALC],
21
            $this->paramsNames[static::ACTION_FIELD_MIN_LEN],
22
            $this->paramsNames[static::ACTION_FIELD_MAX_LEN],
23
            $this->paramsNames[static::ACTION_FIELD_LANGUAGE],
24
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_TASK][static::ACTION_FIELDS][self::ACTION_FIELD_FILE],
25
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_TASK][static::ACTION_FIELDS][self::ACTION_FIELD_PHRASE],
26
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_TASK][static::ACTION_FIELDS][self::ACTION_FIELD_PINGBACK],
27
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_TASK][static::ACTION_FIELDS][self::ACTION_FIELD_REGSENSE],
28
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_TASK][static::ACTION_FIELDS][self::ACTION_FIELD_NUMERIC],
29
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_TASK][static::ACTION_FIELDS][self::ACTION_FIELD_CALC],
30
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_TASK][static::ACTION_FIELDS][self::ACTION_FIELD_MIN_LEN],
31
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_TASK][static::ACTION_FIELDS][self::ACTION_FIELD_MAX_LEN]
32
        );
33
34
        $this->paramsNames[static::ACTION_FIELD_PAGEURL] = 'websiteURL';
35
        $this->paramsNames[static::ACTION_FIELD_GOOGLEKEY] = 'websiteKey';
36
        $this->paramsNames[static::ACTION_FIELD_GOOGLETOKEN] = 'websiteSToken';
37
38
        $task = &$this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_TASK][static::ACTION_FIELDS];
39
        $task[static::ACTION_FIELD_METHOD][static::PARAM_SLUG_DEFAULT] = 'NoCaptchaTask';
40
        $task[static::ACTION_FIELD_PAGEURL] = [
41
            static::PARAM_SLUG_REQUIRE => true,
42
            static::PARAM_SLUG_TYPE => static::PARAM_FIELD_TYPE_STRING,
43
        ];
44
        $task[static::ACTION_FIELD_GOOGLEKEY] = [
45
            static::PARAM_SLUG_REQUIRE => true,
46
            static::PARAM_SLUG_TYPE => static::PARAM_FIELD_TYPE_STRING,
47
        ];
48
        $task[static::ACTION_FIELD_GOOGLETOKEN] = [
49
            static::PARAM_SLUG_TYPE => static::PARAM_FIELD_TYPE_STRING,
50
        ];
51
52
        $this->decodeSettings[static::DECODE_ACTION][static::DECODE_ACTION_GET][static::DECODE_PARAMS][static::DECODE_PARAM_CODE][static::DECODE_PARAM_SETTING_MARKER] = 'solution.gRecaptchaResponse';
53
    }
54
55
    public function recognize($additionally = [], $null = null)
56
    {
57
        return parent::recognize(null, $additionally);
58
    }
59
}
60