Completed
Push — master ( b3c4d7...a3ded8 )
by Владислав
02:15
created

Pixodrom::init()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 56
Code Lines 41

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 56
rs 9.7251
cc 1
eloc 41
nc 1
nop 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace jumper423\decaptcha\services;
4
5
/**
6
 * Class Pixodrom.
7
 */
8
class Pixodrom extends RuCaptcha
9
{
10
    protected $host = 'pixodrom.com';
11
12
    public function init()
13
    {
14
        parent::init();
15
16
        unset(
17
            $this->paramsNames[self::ACTION_FIELD_LANGUAGE],
18
            $this->paramsNames[self::ACTION_FIELD_QUESTION],
19
            $this->paramsNames[self::ACTION_FIELD_INSTRUCTIONS],
20
            $this->paramsNames[self::ACTION_FIELD_PINGBACK],
21
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][self::ACTION_FIELD_LANGUAGE],
22
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][self::ACTION_FIELD_QUESTION],
23
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][self::ACTION_FIELD_INSTRUCTIONS],
24
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][self::ACTION_FIELD_PINGBACK]
25
        );
26
        $this->paramsNames[self::ACTION_FIELD_IS_RUSSIAN] = 'is_russian';
27
        $this->paramsNames[self::ACTION_FIELD_LABEL] = 'label';
28
        $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_IS_RUSSIAN] = [
29
            static::PARAM_SLUG_DEFAULT => 0,
30
            static::PARAM_SLUG_TYPE    => static::PARAM_FIELD_TYPE_INTEGER,
31
            static::PARAM_SLUG_ENUM    => [
32
                0,
33
                1,
34
            ],
35
        ];
36
        $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_NUMERIC][static::PARAM_SLUG_ENUM] = [
37
            0,
38
            1,
39
            2,
40
        ];
41
        $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_LABEL] = [
42
            static::PARAM_SLUG_TYPE => static::PARAM_FIELD_TYPE_STRING,
43
        ];
44
        $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][self::ACTION_FIELD_SOFT_ID][self::PARAM_SLUG_DEFAULT] = 0;
45
46
        $this->wiki->setText(['service', 'name'], 'Pixodrom');
47
        $this->wiki->setText(['service', 'href'], 'http://pixodrom.com/');
48
        $this->wiki->setText(['service', 'desc'], [
49
            'ru' => ' ... ',
50
        ]);
51
        $this->wiki->setText(['recognize', 'price'], [
52
            'ru' => ' ... ',
53
        ]);
54
        $this->wiki->setText(['field', 'slug', static::PARAM_SLUG_ENUM, static::ACTION_FIELD_NUMERIC], [
55
            'ru' => [
56
                '0 - параметр не задействован',
57
                '1 - капча состоит только из цифр',
58
                '2 - в капче нет цифр',
59
            ],
60
        ]);
61
        $this->wiki->setText(['field', 'slug', static::PARAM_SLUG_ENUM, static::ACTION_FIELD_IS_RUSSIAN], [
62
            'ru' => [
63
                '0 - параметр не задействован',
64
                '1 - на изображении присутствуют русские символы',
65
            ],
66
        ]);
67
    }
68
}
69