Conditions | 1 |
Paths | 1 |
Total Lines | 68 |
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_LANGUAGE], |
||
18 | $this->paramsNames[static::ACTION_FIELD_QUESTION], |
||
19 | $this->paramsNames[static::ACTION_FIELD_INSTRUCTIONS], |
||
20 | $this->paramsNames[static::ACTION_FIELD_PINGBACK], |
||
21 | $this->paramsNames[static::ACTION_FIELD_LANG], |
||
22 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_LANGUAGE], |
||
23 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_QUESTION], |
||
24 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_INSTRUCTIONS], |
||
25 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_PINGBACK], |
||
26 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_LANG] |
||
27 | ); |
||
28 | $this->paramsNames[static::ACTION_FIELD_IS_RUSSIAN] = 'is_russian'; |
||
29 | $this->paramsNames[static::ACTION_FIELD_LABEL] = 'label'; |
||
30 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_IS_RUSSIAN] = [ |
||
31 | static::PARAM_SLUG_DEFAULT => 0, |
||
32 | static::PARAM_SLUG_TYPE => static::PARAM_FIELD_TYPE_INTEGER, |
||
33 | static::PARAM_SLUG_ENUM => [ |
||
34 | 0, |
||
35 | 1, |
||
36 | ], |
||
37 | ]; |
||
38 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_NUMERIC][static::PARAM_SLUG_ENUM] = [ |
||
39 | 0, |
||
40 | 1, |
||
41 | 2, |
||
42 | ]; |
||
43 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_LABEL] = [ |
||
44 | static::PARAM_SLUG_TYPE => static::PARAM_FIELD_TYPE_STRING, |
||
45 | ]; |
||
46 | $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_SOFT_ID][static::PARAM_SLUG_DEFAULT] = 0; |
||
47 | |||
48 | $this->wiki->setText(['service', 'name'], 'Pixodrom'); |
||
49 | $this->wiki->setText(['service', 'href'], 'http://pixodrom.com/'); |
||
50 | $this->wiki->setText(['service', 'desc'], [ |
||
51 | 'ru' => ' ... ', |
||
52 | ]); |
||
53 | $this->wiki->setText(['recognize', 'price'], [ |
||
54 | 'ru' => ' ... ', |
||
55 | ]); |
||
56 | $this->wiki->setText(['field', 'slug', static::PARAM_SLUG_ENUM, static::ACTION_FIELD_NUMERIC], [ |
||
57 | 'ru' => [ |
||
58 | '0 - параметр не задействован', |
||
59 | '1 - капча состоит только из цифр', |
||
60 | '2 - в капче нет цифр', |
||
61 | ], |
||
62 | 'en' => [ |
||
63 | '0 - parameter not used', |
||
64 | '1 - captcha consists only of digits', |
||
65 | '2 - the captcha has no numbers', |
||
66 | ], |
||
67 | ]); |
||
68 | $this->wiki->setText(['field', 'slug', static::PARAM_SLUG_ENUM, static::ACTION_FIELD_IS_RUSSIAN], [ |
||
69 | 'ru' => [ |
||
70 | '0 - параметр не задействован', |
||
71 | '1 - на изображении присутствуют русские символы', |
||
72 | ], |
||
73 | 'en' => [ |
||
74 | '0 - parameter not used', |
||
75 | '1 - in the image there are Russian characters', |
||
76 | ], |
||
77 | ]); |
||
78 | $this->wiki->setText(['menu', 'from_service'], null); |
||
79 | } |
||
80 | } |
||
81 |