Conditions | 1 |
Paths | 1 |
Total Lines | 59 |
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 |
||
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->paramsNames[static::ACTION_FIELD_LANG], |
||
21 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_QUESTION], |
||
22 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_INSTRUCTIONS], |
||
23 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_PINGBACK], |
||
24 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_LANG] |
||
25 | ); |
||
26 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_NUMERIC][static::PARAM_SLUG_ENUM] = [ |
||
27 | 0, |
||
28 | 1, |
||
29 | ]; |
||
30 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_LANGUAGE][static::PARAM_SLUG_ENUM] = [ |
||
31 | 0, |
||
32 | 1, |
||
33 | ]; |
||
34 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_SOFT_ID][static::PARAM_SLUG_DEFAULT] = 927; |
||
35 | |||
36 | $this->wiki->setText(['service', 'name'], 'Captcha24'); |
||
37 | $this->wiki->setText(['service', 'href'], 'http://captcha24.com/'); |
||
38 | $this->wiki->setText(['service', 'desc'], [ |
||
39 | 'ru' => 'captcha24.com - сервис ручного распознавания графических изображений, здесь встречаются те, кому нужно в режиме реального времени разгадывать изображения ( сканы документов, каптчи, другое) и те, кто готов это делать за деньги. |
||
40 | |||
41 | 99% работников captcha24 знают русский язык, а потому распознавание документов на русском языке доходит до 95%.', |
||
42 | '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. |
||
43 | |||
44 | 99% of employees captcha24 know Russian language, but because the recognition of documents in the Russian language comes to 95%.', |
||
45 | ]); |
||
46 | $this->wiki->setText(['recognize', 'price'], [ |
||
47 | 'ru' => ' ... ', |
||
48 | ]); |
||
49 | $this->wiki->setText(['field', 'slug', static::PARAM_SLUG_ENUM, static::ACTION_FIELD_NUMERIC], [ |
||
50 | 'ru' => [ |
||
51 | '0 - параметр не задействован', |
||
52 | '1 - капча состоит только из цифр', |
||
53 | ], |
||
54 | 'en' => [ |
||
55 | '0 - parameter not used', |
||
56 | '1 - captcha consists only of digits', |
||
57 | ], |
||
58 | ]); |
||
59 | $this->wiki->setText(['field', 'slug', static::PARAM_SLUG_ENUM, static::ACTION_FIELD_LANGUAGE], [ |
||
60 | 'ru' => [ |
||
61 | '0 - параметр не задействован', |
||
62 | '1 - на капче только кириллические буквы', |
||
63 | ], |
||
64 | 'en' => [ |
||
65 | '0 - parameter not used', |
||
66 | '1 - the captcha only Cyrillic letters', |
||
67 | ], |
||
68 | ]); |
||
69 | $this->wiki->setText(['menu', 'from_service'], null); |
||
70 | } |
||
71 | } |
||
72 |