| Conditions | 1 |
| Paths | 1 |
| Total Lines | 59 |
| Code Lines | 43 |
| 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 |
||
| 25 | public function update_schema() |
||
| 26 | { |
||
| 27 | return array( |
||
| 28 | 'add_tables' => array( |
||
| 29 | $this->table_prefix . 'ideas_ideas' => array( |
||
| 30 | 'COLUMNS' => array( |
||
| 31 | 'idea_id' => array('UINT', null, 'auto_increment'), |
||
| 32 | 'idea_author' => array('UINT', 0), |
||
| 33 | 'idea_title' => array('VCHAR', ''), |
||
| 34 | 'idea_date' => array('TIMESTAMP', 0), |
||
| 35 | 'idea_votes_up' => array('UINT', 0), |
||
| 36 | 'idea_votes_down' => array('UINT', 0), |
||
| 37 | 'idea_status' => array('UINT', 1), |
||
| 38 | 'topic_id' => array('UINT', 0), |
||
| 39 | ), |
||
| 40 | 'PRIMARY_KEY' => 'idea_id', |
||
| 41 | ), |
||
| 42 | $this->table_prefix . 'ideas_statuses' => array( |
||
| 43 | 'COLUMNS' => array( |
||
| 44 | 'status_id' => array('UINT', 0), |
||
| 45 | 'status_name' => array('VCHAR', ''), |
||
| 46 | ), |
||
| 47 | 'PRIMARY_KEY' => 'status_id', |
||
| 48 | ), |
||
| 49 | $this->table_prefix . 'ideas_tickets' => array( |
||
| 50 | 'COLUMNS' => array( |
||
| 51 | 'idea_id' => array('UINT', 0), |
||
| 52 | 'ticket_id' => array('UINT', 0), |
||
| 53 | ), |
||
| 54 | 'KEYS' => array( |
||
| 55 | 'ticket_key' => array('INDEX', array('idea_id', 'ticket_id')), |
||
| 56 | ), |
||
| 57 | ), |
||
| 58 | $this->table_prefix . 'ideas_rfcs' => array( |
||
| 59 | 'COLUMNS' => array( |
||
| 60 | 'idea_id' => array('UINT', 0), |
||
| 61 | 'rfc_link' => array('VCHAR', ''), |
||
| 62 | ), |
||
| 63 | 'KEYS' => array( |
||
| 64 | 'rfc_key' => array('INDEX', array('idea_id', 'rfc_link')), |
||
| 65 | ), |
||
| 66 | ), |
||
| 67 | $this->table_prefix . 'ideas_votes' => array( |
||
| 68 | 'COLUMNS' => array( |
||
| 69 | 'idea_id' => array('UINT', 0), |
||
| 70 | 'user_id' => array('UINT', 0), |
||
| 71 | 'vote_value' => array('BOOL', 0), |
||
| 72 | ), |
||
| 73 | 'KEYS' => array( |
||
| 74 | 'idea_id' => array('INDEX', array('idea_id', 'user_id')), |
||
| 75 | ), |
||
| 76 | ), |
||
| 77 | $this->table_prefix . 'ideas_duplicates' => array( |
||
| 78 | 'COLUMNS' => array( |
||
| 79 | 'idea_id' => array('UINT', 0), |
||
| 80 | 'duplicate_id' => array('UINT', 0), |
||
| 81 | ), |
||
| 82 | 'KEYS' => array( |
||
| 83 | 'dupe_key' => array('INDEX', array('idea_id', 'duplicate_id')), |
||
| 84 | ), |
||
| 104 |