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