| Conditions | 1 |
| Paths | 1 |
| Total Lines | 85 |
| Code Lines | 66 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
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 |
||
| 113 | public function noAssociationData() |
||
| 114 | { |
||
| 115 | return [ |
||
| 116 | 'array' => [ |
||
| 117 | $array = 'array', |
||
| 118 | $array, |
||
| 119 | Guess::HIGH_CONFIDENCE, |
||
| 120 | ], |
||
| 121 | 'json' => [ |
||
| 122 | 'json', |
||
| 123 | $array, |
||
| 124 | Guess::HIGH_CONFIDENCE, |
||
| 125 | ], |
||
| 126 | 'boolean' => [ |
||
| 127 | $boolean = 'boolean', |
||
| 128 | $boolean, |
||
| 129 | Guess::HIGH_CONFIDENCE, |
||
| 130 | ], |
||
| 131 | 'datetime' => [ |
||
| 132 | $datetime = 'datetime', |
||
| 133 | $datetime, |
||
| 134 | Guess::HIGH_CONFIDENCE, |
||
| 135 | ], |
||
| 136 | 'vardatetime' => [ |
||
| 137 | 'vardatetime', |
||
| 138 | $datetime, |
||
| 139 | Guess::HIGH_CONFIDENCE, |
||
| 140 | ], |
||
| 141 | 'datetimetz' => [ |
||
| 142 | 'datetimetz', |
||
| 143 | $datetime, |
||
| 144 | Guess::HIGH_CONFIDENCE, |
||
| 145 | ], |
||
| 146 | 'date' => [ |
||
| 147 | $date = 'date', |
||
| 148 | $date, |
||
| 149 | Guess::HIGH_CONFIDENCE, |
||
| 150 | ], |
||
| 151 | 'decimal' => [ |
||
| 152 | 'decimal', |
||
| 153 | $number = 'number', |
||
| 154 | Guess::MEDIUM_CONFIDENCE, |
||
| 155 | ], |
||
| 156 | 'float' => [ |
||
| 157 | 'float', |
||
| 158 | $number, |
||
| 159 | Guess::MEDIUM_CONFIDENCE, |
||
| 160 | ], |
||
| 161 | 'integer' => [ |
||
| 162 | $integer = 'integer', |
||
| 163 | $integer, |
||
| 164 | Guess::MEDIUM_CONFIDENCE, |
||
| 165 | ], |
||
| 166 | 'bigint' => [ |
||
| 167 | 'bigint', |
||
| 168 | $integer, |
||
| 169 | Guess::MEDIUM_CONFIDENCE, |
||
| 170 | ], |
||
| 171 | 'smallint' => [ |
||
| 172 | 'smallint', |
||
| 173 | $integer, |
||
| 174 | Guess::MEDIUM_CONFIDENCE, |
||
| 175 | ], |
||
| 176 | 'string' => [ |
||
| 177 | 'string', |
||
| 178 | $text = 'text', |
||
| 179 | Guess::MEDIUM_CONFIDENCE, |
||
| 180 | ], |
||
| 181 | 'text' => [ |
||
| 182 | 'text', |
||
| 183 | 'textarea', |
||
| 184 | Guess::MEDIUM_CONFIDENCE, |
||
| 185 | ], |
||
| 186 | 'time' => [ |
||
| 187 | $time = 'time', |
||
| 188 | $time, |
||
| 189 | Guess::HIGH_CONFIDENCE, |
||
| 190 | ], |
||
| 191 | 'somefake' => [ |
||
| 192 | 'somefake', |
||
| 193 | $text, |
||
| 194 | Guess::LOW_CONFIDENCE, |
||
| 195 | ], |
||
| 196 | ]; |
||
| 197 | } |
||
| 198 | } |
||
| 199 |