Conditions | 1 |
Paths | 1 |
Total Lines | 67 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
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:
If many parameters/temporary variables are present:
1 | <?php |
||
10 | public function init() |
||
11 | { |
||
12 | parent::init(); |
||
13 | |||
14 | unset( |
||
15 | $this->paramsNames[static::ACTION_FIELD_PHRASE], |
||
16 | $this->paramsNames[static::ACTION_FIELD_PINGBACK], |
||
17 | $this->paramsNames[static::ACTION_FIELD_REGSENSE], |
||
18 | $this->paramsNames[static::ACTION_FIELD_NUMERIC], |
||
19 | $this->paramsNames[static::ACTION_FIELD_CALC], |
||
20 | $this->paramsNames[static::ACTION_FIELD_MIN_LEN], |
||
21 | $this->paramsNames[static::ACTION_FIELD_MAX_LEN], |
||
22 | $this->paramsNames[static::ACTION_FIELD_LANGUAGE], |
||
23 | $this->paramsNames[static::ACTION_FIELD_LANG], |
||
24 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_PHRASE], |
||
25 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_NUMERIC], |
||
26 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_PINGBACK], |
||
27 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_CALC], |
||
28 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_REGSENSE], |
||
29 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_MIN_LEN], |
||
30 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_MAX_LEN], |
||
31 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_LANGUAGE], |
||
32 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_LANG] |
||
33 | ); |
||
34 | |||
35 | $this->paramsNames[static::ACTION_FIELD_RECAPTCHA] = 'recaptcha'; |
||
36 | |||
37 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_RECAPTCHA] = [ |
||
38 | static::PARAM_SLUG_DEFAULT => 1, |
||
39 | static::PARAM_SLUG_TYPE => static::PARAM_FIELD_TYPE_INTEGER, |
||
40 | static::PARAM_SLUG_NOTWIKI => true, |
||
41 | ]; |
||
42 | |||
43 | $this->wiki->setText(['service', 'name'], [ |
||
44 | 'ru' => 'RuCaptcha Сетка (ReCaptcha v2)', |
||
45 | 'en' => 'RuCaptcha Grid (ReCaptcha v2)', |
||
46 | ]); |
||
47 | $this->wiki->setText(['recognize', 'price'], [ |
||
48 | 'ru' => 'Стоимость 1000 распознаний данной капчи - 70 рублей.', |
||
49 | 'en' => 'It costs $1,2 to recognize 1000 CAPTCHAs this way.', |
||
50 | ]); |
||
51 | $this->wiki->setText(['recognize', 'desc'], [ |
||
52 | 'ru' => 'Для решения рекапчи, где нужно выбирать определённые квадраты. В ответ придут номера картинок, на которые надо нажать. |
||
53 | |||
54 | Обратите внимание, что рекапчи бывают не только 3 на 3 квадрата, но попадаются и 4 на 4 квадрата. Что бы понять какую именно картинку Вы шлёте, мы смотрим размер в px картинки. Если она 300x300px, то мы накладываем на эту картинку сетку 3х3. Если размер другой - накладываем сетку 4х4. Поэтому не надо склеивать изображение с чем-либо. |
||
55 | |||
56 | Обратите внимание, что необходимо засылать саму картинку рекапчи, а не делать её скриншот.', |
||
57 | 'en' => 'To solve reCAPTCHA, where you need to choose specific squares. The answer will come number of pictures, which you should click. |
||
58 | |||
59 | Note that not only are reCAPTCHA 3 by 3 square but there are also 4 by 4 square. To understand what kind of image you shlёte, we look at the size of the image px. If she 300x300px, then we put on this picture 3x3 grid. If the size of the other - impose a 4x4 grid. Therefore, it is not necessary to glue the picture with something. |
||
60 | |||
61 | Please note that you need to send the picture itself reCAPTCHA, instead of doing it the screenshot.', |
||
62 | ]); |
||
63 | $this->wiki->setText(['recognize', 'data'], [ |
||
64 | static::ACTION_FIELD_INSTRUCTIONS => 'Where\'s the cat?', |
||
65 | ]); |
||
66 | $this->wiki->setText(['menu', 'from_service'], [ |
||
67 | RuCaptcha::class, |
||
68 | RuCaptchaInstruction::class, |
||
69 | RuCaptchaClick::class, |
||
70 | RuCaptchaReCaptcha::class, |
||
71 | RuCaptchaKeyCaptcha::class, |
||
72 | RuCaptchaFunCaptcha::class, |
||
73 | RuCaptchaReCaptchaV3::class, |
||
74 | RuCaptchaGeeTest::class, |
||
75 | ]); |
||
76 | } |
||
77 | |||
89 |