| Conditions | 1 |
| Paths | 1 |
| Total Lines | 116 |
| Code Lines | 3 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| 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 |
||
| 223 | protected function updateMenu() |
||
| 224 | { |
||
| 225 | // Add default admin menu |
||
| 226 | // TODO: Translate |
||
| 227 | $menu = Menu::find(1); |
||
| 228 | $menu->data = json_decode('[ |
||
| 229 | { |
||
| 230 | "color":"grey", |
||
| 231 | "nochildren":false, |
||
| 232 | "icon":"settings", |
||
| 233 | "translation":"Dashboard", |
||
| 234 | "label":"menu.dashboard", |
||
| 235 | "type":"module", |
||
| 236 | "route":"uccello.settings.dashboard", |
||
| 237 | "module":"settings", |
||
| 238 | "id":1 |
||
| 239 | }, |
||
| 240 | { |
||
| 241 | "color":"green", |
||
| 242 | "nochildren":false, |
||
| 243 | "icon":"lock", |
||
| 244 | "label":"menu.security", |
||
| 245 | "type":"group", |
||
| 246 | "id":2, |
||
| 247 | "children":[ |
||
| 248 | { |
||
| 249 | "color":"grey", |
||
| 250 | "nochildren":false, |
||
| 251 | "icon":"person", |
||
| 252 | "translation":"Users", |
||
| 253 | "label":"user", |
||
| 254 | "type":"module", |
||
| 255 | "route":"uccello.list", |
||
| 256 | "module":"user", |
||
| 257 | "id":3 |
||
| 258 | }, |
||
| 259 | { |
||
| 260 | "color":"grey", |
||
| 261 | "nochildren":false, |
||
| 262 | "icon":"group", |
||
| 263 | "translation":"Group", |
||
| 264 | "label":"group", |
||
| 265 | "type":"module", |
||
| 266 | "route":"uccello.list", |
||
| 267 | "module":"group", |
||
| 268 | "id":4 |
||
| 269 | }, |
||
| 270 | { |
||
| 271 | "color":"grey", |
||
| 272 | "nochildren":false, |
||
| 273 | "icon":"domain", |
||
| 274 | "translation":"Domains", |
||
| 275 | "label":"domain", |
||
| 276 | "type":"module", |
||
| 277 | "route":"uccello.list", |
||
| 278 | "module":"domain", |
||
| 279 | "id":5 |
||
| 280 | }, |
||
| 281 | { |
||
| 282 | "color":"grey", |
||
| 283 | "nochildren":false, |
||
| 284 | "icon":"lock", |
||
| 285 | "translation":"Roles", |
||
| 286 | "label":"role", |
||
| 287 | "type":"module", |
||
| 288 | "route":"uccello.list", |
||
| 289 | "module":"role", |
||
| 290 | "id":6 |
||
| 291 | }, |
||
| 292 | { |
||
| 293 | "color":"grey", |
||
| 294 | "nochildren":false, |
||
| 295 | "icon":"lock", |
||
| 296 | "translation":"Profiles", |
||
| 297 | "label":"profile", |
||
| 298 | "type":"module", |
||
| 299 | "route":"uccello.list", |
||
| 300 | "module":"profile", |
||
| 301 | "id":7 |
||
| 302 | } |
||
| 303 | ] |
||
| 304 | }, |
||
| 305 | { |
||
| 306 | "color":"green", |
||
| 307 | "nochildren":false, |
||
| 308 | "icon":"settings", |
||
| 309 | "label":"menu.settings", |
||
| 310 | "type":"group", |
||
| 311 | "id":7, |
||
| 312 | "children":[ |
||
| 313 | { |
||
| 314 | "color":"grey", |
||
| 315 | "nochildren":false, |
||
| 316 | "icon":"extension", |
||
| 317 | "translation":"Module manager", |
||
| 318 | "label":"module_manager.link", |
||
| 319 | "type":"module", |
||
| 320 | "route":"uccello.settings.module.manager", |
||
| 321 | "module":"settings", |
||
| 322 | "id":8 |
||
| 323 | }, |
||
| 324 | { |
||
| 325 | "color":"grey", |
||
| 326 | "nochildren":false, |
||
| 327 | "icon":"menu", |
||
| 328 | "translation":"Menu manager", |
||
| 329 | "label":"menu_manager.link", |
||
| 330 | "type":"module", |
||
| 331 | "route":"uccello.settings.menu.manager", |
||
| 332 | "module":"settings", |
||
| 333 | "id":9 |
||
| 334 | } |
||
| 335 | ] |
||
| 336 | } |
||
| 337 | ]'); |
||
| 338 | $menu->save(); |
||
| 339 | } |
||
| 342 |
Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.