| Conditions | 1 |
| Paths | 1 |
| Total Lines | 60 |
| Code Lines | 48 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| 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 |
||
| 116 | protected function addForeignKeys() |
||
| 117 | { |
||
| 118 | $this->addForeignKey( |
||
| 119 | $this->db->getForeignKeyName('{{%cacheflag_flags}}', 'sectionId'), |
||
| 120 | '{{%cacheflag_flags}}', |
||
| 121 | 'sectionId', |
||
| 122 | '{{%sections}}', |
||
| 123 | 'id', |
||
| 124 | 'CASCADE', |
||
| 125 | 'CASCADE' |
||
| 126 | ); |
||
| 127 | |||
| 128 | $this->addForeignKey( |
||
| 129 | $this->db->getForeignKeyName('{{%cacheflag_flags}}', 'categoryGroupId'), |
||
| 130 | '{{%cacheflag_flags}}', |
||
| 131 | 'categoryGroupId', |
||
| 132 | '{{%categorygroups}}', |
||
| 133 | 'id', |
||
| 134 | 'CASCADE', |
||
| 135 | 'CASCADE' |
||
| 136 | ); |
||
| 137 | |||
| 138 | $this->addForeignKey( |
||
| 139 | $this->db->getForeignKeyName('{{%cacheflag_flags}}', 'tagGroupId'), |
||
| 140 | '{{%cacheflag_flags}}', |
||
| 141 | 'tagGroupId', |
||
| 142 | '{{%taggroups}}', |
||
| 143 | 'id', |
||
| 144 | 'CASCADE', |
||
| 145 | 'CASCADE' |
||
| 146 | ); |
||
| 147 | |||
| 148 | $this->addForeignKey( |
||
| 149 | $this->db->getForeignKeyName('{{%cacheflag_flags}}', 'userGroupId'), |
||
| 150 | '{{%cacheflag_flags}}', |
||
| 151 | 'userGroupId', |
||
| 152 | '{{%usergroups}}', |
||
| 153 | 'id', |
||
| 154 | 'CASCADE', |
||
| 155 | 'CASCADE' |
||
| 156 | ); |
||
| 157 | |||
| 158 | $this->addForeignKey( |
||
| 159 | $this->db->getForeignKeyName('{{%cacheflag_flags}}', 'volumeId'), |
||
| 160 | '{{%cacheflag_flags}}', |
||
| 161 | 'volumeId', |
||
| 162 | '{{%volumes}}', |
||
| 163 | 'id', |
||
| 164 | 'CASCADE', |
||
| 165 | 'CASCADE' |
||
| 166 | ); |
||
| 167 | |||
| 168 | $this->addForeignKey( |
||
| 169 | $this->db->getForeignKeyName('{{%cacheflag_flags}}', 'globalSetId'), |
||
| 170 | '{{%cacheflag_flags}}', |
||
| 171 | 'globalSetId', |
||
| 172 | '{{%globalsets}}', |
||
| 173 | 'id', |
||
| 174 | 'CASCADE', |
||
| 175 | 'CASCADE' |
||
| 176 | ); |
||
| 196 |