Conditions | 1 |
Paths | 1 |
Total Lines | 104 |
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_FILE], |
||
16 | $this->paramsNames[static::ACTION_FIELD_PINGBACK], |
||
17 | $this->paramsNames[static::ACTION_FIELD_NUMERIC], |
||
18 | $this->paramsNames[static::ACTION_FIELD_MIN_LEN], |
||
19 | $this->paramsNames[static::ACTION_FIELD_MAX_LEN], |
||
20 | $this->paramsNames[static::ACTION_FIELD_QUESTION], |
||
21 | $this->paramsNames[static::ACTION_FIELD_PHRASE], |
||
22 | $this->paramsNames[static::ACTION_FIELD_CALC], |
||
23 | $this->paramsNames[static::ACTION_FIELD_REGSENSE], |
||
24 | $this->paramsNames[static::ACTION_FIELD_LANGUAGE], |
||
25 | $this->paramsNames[static::ACTION_FIELD_LANG], |
||
26 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_FILE], |
||
27 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_REGSENSE], |
||
28 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_NUMERIC], |
||
29 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_PINGBACK], |
||
30 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_MIN_LEN], |
||
31 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_MAX_LEN], |
||
32 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_PHRASE], |
||
33 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_CALC], |
||
34 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_QUESTION], |
||
35 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_LANGUAGE], |
||
36 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_LANG] |
||
37 | ); |
||
38 | |||
39 | $this->paramsNames[static::ACTION_FIELD_GOOGLEKEY] = 'googlekey'; |
||
40 | $this->paramsNames[static::ACTION_FIELD_PROXY] = 'proxy'; |
||
41 | $this->paramsNames[static::ACTION_FIELD_PROXYTYPE] = 'proxytype'; |
||
42 | $this->paramsNames[static::ACTION_FIELD_PAGEURL] = 'pageurl'; |
||
43 | $this->paramsNames[static::ACTION_FIELD_INVISIBLE] = 'invisible'; |
||
44 | |||
45 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_METHOD][static::PARAM_SLUG_DEFAULT] = 'userrecaptcha'; |
||
46 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_GOOGLEKEY] = [ |
||
47 | static::PARAM_SLUG_REQUIRE => true, |
||
48 | static::PARAM_SLUG_TYPE => static::PARAM_FIELD_TYPE_STRING, |
||
49 | ]; |
||
50 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_PROXY] = [ |
||
51 | static::PARAM_SLUG_TYPE => static::PARAM_FIELD_TYPE_STRING, |
||
52 | ]; |
||
53 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_PROXYTYPE] = [ |
||
54 | static::PARAM_SLUG_TYPE => static::PARAM_FIELD_TYPE_STRING, |
||
55 | ]; |
||
56 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_PAGEURL] = [ |
||
57 | static::PARAM_SLUG_REQUIRE => true, |
||
58 | static::PARAM_SLUG_TYPE => static::PARAM_FIELD_TYPE_STRING, |
||
59 | ]; |
||
60 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_INVISIBLE] = [ |
||
61 | static::PARAM_SLUG_TYPE => static::PARAM_FIELD_TYPE_INTEGER, |
||
62 | static::PARAM_SLUG_DEFAULT => 0, |
||
63 | ]; |
||
64 | |||
65 | $this->wiki->setText(['service', 'name'], [ |
||
66 | 'ru' => 'RuCaptcha ReCaptcha v2 без браузера', |
||
67 | 'en' => 'RuCaptcha ReCaptcha v2 without a browser', |
||
68 | ]); |
||
69 | $this->wiki->setText(['recognize', 'price'], [ |
||
70 | 'ru' => '1000 решений стоят 160 рублей.', |
||
71 | 'en' => '1000 for $2,99', |
||
72 | ]); |
||
73 | $this->wiki->setText(['recognize', 'desc'], [ |
||
74 | 'ru' => 'Данный способ позволяет пройти рекапчу без эмуляции браузера и отправки нам картинок, так же этот способ даёт 100% прохождение капчи. |
||
75 | |||
76 | Где какие данные брать и куда вставлять? |
||
77 | Посмотрите HTML-код страницы, где Вы встретили капчу: |
||
78 | |||
79 | 1. найдите параметр |
||
80 | data-sitekey= |
||
81 | Это ключ сайта, он постоянен и уникален для каждого сайта (если администратор сайта не поменяет его вручную) |
||
82 | |||
83 | 2.найдите форму для текста |
||
84 | ```<textarea id="g-recaptcha-response" name="g-recaptcha-response" class="g-recaptcha-response" style="width: 250px; height: 40px; border: 1px solid #c1c1c1; margin: 10px 25px; padding: 0px; resize: none; "></textarea>``` |
||
85 | Сюда вам нужно будет вставить ответ от нас.', |
||
86 | 'en' => 'This method allows you to pass the reCAPTCHA without emulation browser and send us pictures, as this method gives 100% passing captcha. |
||
87 | |||
88 | Where any information to take and where to insert? |
||
89 | See page HTML-code, where you met the captcha: |
||
90 | |||
91 | 1. Locate the parameter |
||
92 | data-sitekey = |
||
93 | This site key, it is constant and unique for each site (if the site administrator does not change it manually) |
||
94 | |||
95 | 2.Locate form for text |
||
96 | ```<textarea id="g-recaptcha-response" name="g-recaptcha-response" class="g-recaptcha-response" style="width: 250px; height: 40px; border: 1px solid #c1c1c1; margin: 10px 25px; padding: 0px; resize: none; "></textarea>``` |
||
97 | Here you will need to insert a reply from us.', |
||
98 | ]); |
||
99 | $this->wiki->setText(['recognize', 'data'], [ |
||
100 | static::ACTION_FIELD_GOOGLEKEY => '54as5c6a5s4ca4s56a4sc56a', |
||
101 | static::ACTION_FIELD_PAGEURL => 'http://site.com/recaptcha-ex', |
||
102 | ]); |
||
103 | $this->wiki->setText(['recognize', 'file'], false); |
||
104 | $this->wiki->setText(['menu', 'from_service'], [ |
||
105 | RuCaptcha::class, |
||
106 | RuCaptchaClick::class, |
||
107 | RuCaptchaInstruction::class, |
||
108 | RuCaptchaGrid::class, |
||
109 | RuCaptchaFunCaptcha::class, |
||
110 | RuCaptchaReCaptchaV3::class, |
||
111 | RuCaptchaGeeTest::class, |
||
112 | ]); |
||
113 | } |
||
114 | |||
120 |