Completed
Push — master ( 37f6c8...839c73 )
by Владислав
12:06 queued 08:43
created

Captcha24::init()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 57
Code Lines 38

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 57
rs 9.6818
cc 1
eloc 38
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 Captcha24.
7
 */
8
class Captcha24 extends RuCaptcha
9
{
10
    protected $host = 'captcha24.com';
11
12
    public function init()
13
    {
14
        parent::init();
15
16
        unset(
17
            $this->paramsNames[static::ACTION_FIELD_QUESTION],
18
            $this->paramsNames[static::ACTION_FIELD_INSTRUCTIONS],
19
            $this->paramsNames[static::ACTION_FIELD_PINGBACK],
20
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_QUESTION],
21
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_INSTRUCTIONS],
22
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_PINGBACK]
23
        );
24
        $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_NUMERIC][static::PARAM_SLUG_ENUM] = [
25
            0,
26
            1,
27
        ];
28
        $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_LANGUAGE][static::PARAM_SLUG_ENUM] = [
29
            0,
30
            1,
31
        ];
32
        $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_SOFT_ID][static::PARAM_SLUG_DEFAULT] = 0;
33
34
        $this->wiki->setText(['service', 'name'], 'Captcha24');
35
        $this->wiki->setText(['service', 'href'], 'http://captcha24.com/');
36
        $this->wiki->setText(['service', 'desc'], [
37
            'ru' => 'captcha24.com - сервис ручного распознавания графических изображений, здесь встречаются те, кому нужно в режиме реального времени разгадывать изображения ( сканы документов, каптчи, другое) и те, кто готов это делать за деньги.
38
39
99% работников captcha24 знают русский язык, а потому распознавание документов на русском языке доходит до 95%.',
40
            'en' => 'captcha24.com service manual recognition of graphic images, there are those who need in real time to unravel the image ( scans of documents, captcha, etc.) and those who are willing to do it for the money. 
41
            
42
99% of employees captcha24 know Russian language, but because the recognition of documents in the Russian language comes to 95%.',
43
        ]);
44
        $this->wiki->setText(['recognize', 'price'], [
45
            'ru' => ' ... ',
46
        ]);
47
        $this->wiki->setText(['field', 'slug', static::PARAM_SLUG_ENUM, static::ACTION_FIELD_NUMERIC], [
48
            'ru' => [
49
                '0 - параметр не задействован',
50
                '1 - капча состоит только из цифр',
51
            ],
52
            'en' => [
53
                '0 - parameter not used',
54
                '1 - captcha consists only of digits',
55
            ],
56
        ]);
57
        $this->wiki->setText(['field', 'slug', static::PARAM_SLUG_ENUM, static::ACTION_FIELD_LANGUAGE], [
58
            'ru' => [
59
                '0 - параметр не задействован',
60
                '1 - на капче только кириллические буквы',
61
            ],
62
            'en' => [
63
                '0 - parameter not used',
64
                '1 - the captcha only Cyrillic letters',
65
            ],
66
        ]);
67
        $this->wiki->setText(['menu', 'from_service'], null);
68
    }
69
}
70