| Conditions | 2 |
| Paths | 2 |
| Total Lines | 56 |
| 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 |
||
| 41 | public function registerBasicTemplates() |
||
| 42 | { |
||
| 43 | $templates = [ |
||
| 44 | [ |
||
| 45 | 'name' => 'add_iblock', |
||
| 46 | 'path' => $this->dir.'/add_iblock.template', |
||
| 47 | 'description' => 'Add iblock', |
||
| 48 | ], |
||
| 49 | [ |
||
| 50 | 'name' => 'add_iblock_type', |
||
| 51 | 'path' => $this->dir.'/add_iblock_type.template', |
||
| 52 | 'description' => 'Add iblock type', |
||
| 53 | ], |
||
| 54 | [ |
||
| 55 | 'name' => 'add_iblock_element_property', |
||
| 56 | 'path' => $this->dir.'/add_iblock_element_property.template', |
||
| 57 | 'description' => 'Add iblock element property', |
||
| 58 | 'aliases' => [ |
||
| 59 | 'add_iblock_prop', |
||
| 60 | 'add_iblock_element_prop', |
||
| 61 | 'add_element_prop', |
||
| 62 | 'add_element_property', |
||
| 63 | ], |
||
| 64 | ], |
||
| 65 | [ |
||
| 66 | 'name' => 'add_uf', |
||
| 67 | 'path' => $this->dir.'/add_uf.template', |
||
| 68 | 'description' => 'Add user field (for sections, users e.t.c)', |
||
| 69 | ], |
||
| 70 | [ |
||
| 71 | 'name' => 'add_table', |
||
| 72 | 'path' => $this->dir.'/add_table.template', |
||
| 73 | 'description' => 'Create table', |
||
| 74 | 'aliases' => [ |
||
| 75 | 'create_table', |
||
| 76 | ], |
||
| 77 | ], |
||
| 78 | [ |
||
| 79 | 'name' => 'delete_table', |
||
| 80 | 'path' => $this->dir.'/delete_table.template', |
||
| 81 | 'description' => 'Drop table', |
||
| 82 | 'aliases' => [ |
||
| 83 | 'drop_table', |
||
| 84 | ], |
||
| 85 | ], |
||
| 86 | [ |
||
| 87 | 'name' => 'query', |
||
| 88 | 'path' => $this->dir.'/query.template', |
||
| 89 | 'description' => 'Simple database query', |
||
| 90 | ], |
||
| 91 | ]; |
||
| 92 | |||
| 93 | foreach ($templates as $template) { |
||
| 94 | $this->registerTemplate($template); |
||
| 95 | } |
||
| 96 | } |
||
| 97 | |||
| 230 |