Conditions | 1 |
Paths | 1 |
Total Lines | 65 |
Code 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 |
||
27 | public function update_schema() |
||
28 | { |
||
29 | return array( |
||
30 | 'add_tables' => array( |
||
31 | $this->table_prefix . 'sm_content_types' => array( |
||
32 | 'COLUMNS' => array( |
||
33 | 'content_id' => array('UINT', null, 'auto_increment'), |
||
34 | 'forum_id' => array('UINT', 0), |
||
35 | 'content_name' => array('VCHAR:125', ''), |
||
36 | 'content_langname' => array('VCHAR:155', ''), |
||
37 | 'content_enabled' => array('BOOL', 1), |
||
38 | 'content_colour' => array('VCHAR:6', ''), |
||
39 | 'content_desc' => array('TEXT_UNI', ''), |
||
40 | 'content_desc_bitfield' => array('VCHAR:255', ''), |
||
41 | 'content_desc_options' => array('UINT:11', 7), |
||
42 | 'content_desc_uid' => array('VCHAR:8', ''), |
||
43 | 'content_view' => array('VCHAR:155', ''), |
||
44 | 'content_view_settings' => array('VCHAR:255', ''), |
||
45 | 'req_approval' => array('BOOL', 1), |
||
46 | 'allow_comments' => array('BOOL', 1), |
||
47 | 'allow_views' => array('BOOL', 1), |
||
48 | 'show_poster_info' => array('BOOL', 1), |
||
49 | 'show_poster_contents' => array('BOOL', 1), |
||
50 | 'show_pagination' => array('BOOL', 1), |
||
51 | 'index_show_desc' => array('BOOL', 0), |
||
52 | 'items_per_page' => array('TINT:4', 1), |
||
53 | 'summary_tpl' => array('TEXT_UNI', ''), |
||
54 | 'detail_tpl' => array('TEXT_UNI', ''), |
||
55 | 'last_modified' => array('TIMESTAMP', 0) |
||
56 | ), |
||
57 | 'PRIMARY_KEY' => 'content_id', |
||
58 | 'KEYS' => array( |
||
59 | 'name' => array('INDEX', 'content_name'), |
||
60 | ), |
||
61 | ), |
||
62 | $this->table_prefix . 'sm_content_fields' => array( |
||
63 | 'COLUMNS' => array( |
||
64 | 'field_id' => array('UINT', null, 'auto_increment'), |
||
65 | 'content_id' => array('UINT', 0), |
||
66 | 'field_name' => array('VCHAR:125', ''), |
||
67 | 'field_label' => array('VCHAR:125', ''), |
||
68 | 'field_explain' => array('VCHAR:255', ''), |
||
69 | 'field_type' => array('VCHAR:55', ''), |
||
70 | 'field_props' => array('VCHAR:255', ''), |
||
71 | 'field_mod_only' => array('BOOL', 0), |
||
72 | 'field_required' => array('BOOL', 0), |
||
73 | 'field_summary_show' => array('VCHAR:10', ''), |
||
74 | 'field_detail_show' => array('VCHAR:10', ''), |
||
75 | 'field_summary_ldisp' => array('BOOL', 0), |
||
76 | 'field_detail_ldisp' => array('BOOL', 0), |
||
77 | 'field_exp_uid' => array('VCHAR:8', ''), |
||
78 | 'field_exp_bitfield' => array('VCHAR:255', ''), |
||
79 | 'field_exp_options' => array('UINT:11', 7), |
||
80 | 'field_order' => array('TINT:3', 0) |
||
81 | ), |
||
82 | 'PRIMARY_KEY' => 'field_id', |
||
83 | 'KEYS' => array( |
||
84 | 'cid' => array('INDEX', 'content_id'), |
||
85 | ), |
||
86 | ), |
||
87 | ), |
||
88 | 'add_columns' => array( |
||
89 | $this->table_prefix . 'topics' => array( |
||
90 | 'topic_slug' => array('VCHAR:255', ''), |
||
91 | 'req_mod_input' => array('BOOL', 0), |
||
92 | ) |
||
116 |