Conditions | 11 |
Paths | 11 |
Total Lines | 27 |
Code Lines | 17 |
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 |
||
60 | private static function processHandler() { |
||
61 | if (settings::$handler) { |
||
62 | if (isset(BPT::$update->message)) { |
||
63 | if (self::handlerExist('message')) { |
||
64 | BPT::$handler->message(BPT::$update->message); |
||
65 | } |
||
66 | } |
||
67 | elseif (isset(BPT::$update->callback_query)) { |
||
68 | if (self::handlerExist('callback_query')) { |
||
69 | BPT::$handler->callback_query(BPT::$update->callback_query); |
||
70 | } |
||
71 | } |
||
72 | elseif (isset(BPT::$update->inline_query)) { |
||
73 | if (self::handlerExist('inline_query')) { |
||
74 | BPT::$handler->inline_query(BPT::$update->inline_query); |
||
75 | } |
||
76 | } |
||
77 | elseif (isset(BPT::$update->edited_message)) { |
||
78 | if (self::handlerExist('edited_message')) { |
||
79 | BPT::$handler->edited_message(BPT::$update->edited_message); |
||
80 | } |
||
81 | } |
||
82 | elseif (self::handlerExist('something_else')) { |
||
83 | BPT::$handler->something_else(BPT::$update); |
||
84 | } |
||
85 | else { |
||
86 | logger::write('Update received but handlers does not set',loggerTypes::WARNING); |
||
87 | } |
||
97 | } |