| Conditions | 1 |
| Paths | 1 |
| Total Lines | 74 |
| Code Lines | 57 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 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 |
||
| 29 | public function update_schema() |
||
| 30 | { |
||
| 31 | return array( |
||
| 32 | 'add_tables' => array( |
||
| 33 | $this->table_prefix . 'sm_block_routes' => array( |
||
| 34 | 'COLUMNS' => array( |
||
| 35 | 'route_id' => array('UINT', null, 'auto_increment'), |
||
| 36 | 'ext_name' => array('VCHAR:255', ''), |
||
| 37 | 'route' => array('XSTEXT_UNI', ''), |
||
| 38 | 'style' => array('USINT', 0), |
||
| 39 | 'hide_blocks' => array('BOOL', 0), |
||
| 40 | 'has_blocks' => array('BOOL', 0), |
||
| 41 | 'ex_positions' => array('VCHAR:255', ''), |
||
| 42 | ), |
||
| 43 | |||
| 44 | 'PRIMARY_KEY' => 'route_id' |
||
| 45 | ), |
||
| 46 | |||
| 47 | $this->table_prefix . 'sm_blocks' => array( |
||
| 48 | 'COLUMNS' => array( |
||
| 49 | 'bid' => array('UINT', null, 'auto_increment'), |
||
| 50 | 'icon' => array('VCHAR:55', ''), |
||
| 51 | 'name' => array('VCHAR:55', ''), |
||
| 52 | 'title' => array('XSTEXT_UNI', ''), |
||
| 53 | 'route_id' => array('UINT', 0), |
||
| 54 | 'position' => array('VCHAR:55', ''), |
||
| 55 | 'weight' => array('USINT', 0), |
||
| 56 | 'style' => array('USINT', 0), |
||
| 57 | 'permission' => array('VCHAR:125', ''), |
||
| 58 | 'class' => array('VCHAR:125', ''), |
||
| 59 | 'status' => array('BOOL', 1), |
||
| 60 | 'type' => array('BOOL', 0), |
||
| 61 | 'no_wrap' => array('BOOL', 0), |
||
| 62 | 'hide_title' => array('BOOL', 0), |
||
| 63 | 'hash' => array('VCHAR:32', ''), |
||
| 64 | ), |
||
| 65 | |||
| 66 | 'PRIMARY_KEY' => 'bid', |
||
| 67 | |||
| 68 | 'KEYS' => array( |
||
| 69 | 'style' => array('INDEX', 'style'), |
||
| 70 | ), |
||
| 71 | ), |
||
| 72 | |||
| 73 | $this->table_prefix . 'sm_menus' => array( |
||
| 74 | 'COLUMNS' => array( |
||
| 75 | 'menu_id' => array('UINT', null, 'auto_increment'), |
||
| 76 | 'menu_name' => array('VCHAR:55', ''), |
||
| 77 | ), |
||
| 78 | 'PRIMARY_KEY' => 'menu_id', |
||
| 79 | 'KEYS' => array( |
||
| 80 | 'menu_name' => array('UNIQUE', 'menu_name'), |
||
| 81 | 'menu_id' => array('INDEX', 'menu_id'), |
||
| 82 | ), |
||
| 83 | ), |
||
| 84 | |||
| 85 | $this->table_prefix . 'sm_menu_items' => array( |
||
| 86 | 'COLUMNS' => array( |
||
| 87 | 'item_id' => array('UINT', null, 'auto_increment'), |
||
| 88 | 'menu_id' => array('UINT', 0), |
||
| 89 | 'group_id' => array('UINT', 0), |
||
| 90 | 'parent_id' => array('UINT', 0), |
||
| 91 | 'item_title' => array('XSTEXT_UNI', ''), |
||
| 92 | 'item_url' => array('VCHAR_UNI', ''), |
||
| 93 | 'item_icon' => array('VCHAR', ''), |
||
| 94 | 'item_desc' => array('VCHAR:55', ''), |
||
| 95 | 'item_target' => array('BOOL', 0), |
||
| 96 | 'left_id' => array('UINT', 0), |
||
| 97 | 'right_id' => array('UINT', 0), |
||
| 98 | 'depth' => array('UINT', 0), |
||
| 99 | ), |
||
| 100 | 'PRIMARY_KEY' => 'item_id', |
||
| 101 | 'KEYS' => array( |
||
| 102 | 'menu_id' => array('INDEX', 'menu_id'), |
||
| 103 | ), |
||
| 124 |