Conditions | 1 |
Paths | 1 |
Total Lines | 292 |
Code Lines | 236 |
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 |
||
338 | function _flag_abuse_reason_abuse_comment_flags(&$flags) { |
||
339 | |||
340 | // Exported flag: "Comment Abuse meta". |
||
341 | $flags[] = array( |
||
342 | 'content_type' => 'comment', |
||
343 | 'name' => 'abuse_comment_meta', |
||
344 | 'title' => 'Comment Abuse meta', |
||
345 | 'global' => '0', |
||
346 | 'types' => array( |
||
347 | '0' => 'forum', |
||
348 | '1' => 'news', |
||
349 | '2' => 'team_forum', |
||
350 | ), |
||
351 | 'events' => array ( |
||
352 | 0 => 'flag', |
||
353 | 1 => 'unflag', |
||
354 | ), |
||
355 | 'flag_short' => 'Meta Flag for comment', |
||
356 | 'flag_long' => 'Meta Flag for comment.', |
||
357 | 'flag_message' => '', |
||
358 | 'unflag_short' => 'Meta Flag for comment', |
||
359 | 'unflag_long' => 'Meta Flag for comment.', |
||
360 | 'unflag_message' => '', |
||
361 | 'unflag_denied_text' => '', |
||
362 | 'link_type' => 'confirm', |
||
363 | 'roles' => array( |
||
364 | 'flag' => array( |
||
365 | '0' => 2, |
||
366 | ), |
||
367 | 'unflag' => array( |
||
368 | '0' => 2, |
||
369 | ), |
||
370 | ), |
||
371 | 'weight' => 0, |
||
372 | 'access_author' => '', |
||
373 | 'show_on_comment' => 0, |
||
374 | 'flag_confirmation' => 'Are you sure you want to flag this content?', |
||
375 | 'unflag_confirmation' => 'Are you sure you want to unflag this content?', |
||
376 | 'reset_short' => 'Reset flags', |
||
377 | 'reset_long' => 'Reset all flags on this comment', |
||
378 | 'reset_confirmation' => 'Are you sure you want to reset all flags on this comment?', |
||
379 | 'status' => false, |
||
380 | 'show_on_teaser' => false, |
||
381 | 'locked' => array ( |
||
382 | 'name' => 'name', |
||
383 | 'global' => 'global', |
||
384 | ), |
||
385 | 'module' => 'flag_abuse_reason', |
||
386 | 'api_version' => 2, |
||
387 | ); |
||
388 | |||
389 | // Exported flag: "Comment Abuse 1". |
||
390 | $flags[] = array ( |
||
391 | 'content_type' => 'comment', |
||
392 | 'name' => 'abuse_comment_1', |
||
393 | 'title' => 'Comment Abuse 1', |
||
394 | 'global' => false, |
||
395 | 'types' => array ( |
||
396 | '0' => 'forum', |
||
397 | '1' => 'news', |
||
398 | '2' => 'team_forum', |
||
399 | ), |
||
400 | 'events' => array ( |
||
401 | 0 => 'flag', |
||
402 | 1 => 'unflag', |
||
403 | ), |
||
404 | 'flag_short' => 'Flag as offensive', |
||
405 | 'flag_long' => 'Flag this content as offensive.', |
||
406 | 'flag_message' => '', |
||
407 | 'unflag_short' => 'Flag as non-offensive', |
||
408 | 'unflag_long' => 'Flag this content as non-offensive.', |
||
409 | 'unflag_message' => '', |
||
410 | 'unflag_denied_text' => '', |
||
411 | 'link_type' => 'confirm', |
||
412 | 'roles' => array ( |
||
413 | 'flag' => array ( |
||
414 | 0 => '2', |
||
415 | ), |
||
416 | 'unflag' => array ( |
||
417 | 0 => '2', |
||
418 | ), |
||
419 | ), |
||
420 | 'access_author' => '', |
||
421 | 'show_on_comment' => true, |
||
422 | 'flag_confirmation' => 'Are you sure you want to flag this content as offensive?', |
||
423 | 'unflag_confirmation' => 'Are you sure you want to flag this content as non-offensive?', |
||
424 | 'reset_short' => 'Reset flags', |
||
425 | 'reset_long' => 'Reset all flags on this comment', |
||
426 | 'reset_confirmation' => 'Are you sure you want to reset all flags on this comment?', |
||
427 | 'status' => false, |
||
428 | 'show_on_teaser' => false, |
||
429 | 'locked' => array ( |
||
430 | 'name' => 'name', |
||
431 | 'global' => 'global', |
||
432 | ), |
||
433 | 'module' => 'flag_abuse_reason', |
||
434 | 'api_version' => 2, |
||
435 | ); |
||
436 | |||
437 | // Exported flag: "Comment Abuse 2". |
||
438 | $flags[] = array ( |
||
439 | 'content_type' => 'comment', |
||
440 | 'name' => 'abuse_comment_2', |
||
441 | 'title' => 'Comment Abuse 2', |
||
442 | 'global' => false, |
||
443 | 'types' => array ( |
||
444 | '0' => 'forum', |
||
445 | '1' => 'news', |
||
446 | '2' => 'team_forum', |
||
447 | ), |
||
448 | 'events' => array ( |
||
449 | 0 => 'flag', |
||
450 | 1 => 'unflag', |
||
451 | ), |
||
452 | 'flag_short' => 'Flag as offensive', |
||
453 | 'flag_long' => 'Flag this content as offensive.', |
||
454 | 'flag_message' => '', |
||
455 | 'unflag_short' => 'Flag as non-offensive', |
||
456 | 'unflag_long' => 'Flag this content as non-offensive.', |
||
457 | 'unflag_message' => '', |
||
458 | 'unflag_denied_text' => '', |
||
459 | 'link_type' => 'confirm', |
||
460 | 'roles' => array ( |
||
461 | 'flag' => array ( |
||
462 | 0 => '2', |
||
463 | ), |
||
464 | 'unflag' => array ( |
||
465 | 0 => '2', |
||
466 | ), |
||
467 | ), |
||
468 | 'access_author' => '', |
||
469 | 'show_on_comment' => true, |
||
470 | 'flag_confirmation' => 'Are you sure you want to flag this content as offensive?', |
||
471 | 'unflag_confirmation' => 'Are you sure you want to flag this content as non-offensive?', |
||
472 | 'reset_short' => 'Reset flags', |
||
473 | 'reset_long' => 'Reset all flags on this comment', |
||
474 | 'reset_confirmation' => 'Are you sure you want to reset all flags on this comment?', |
||
475 | 'status' => false, |
||
476 | 'show_on_teaser' => false, |
||
477 | 'locked' => array ( |
||
478 | 'name' => 'name', |
||
479 | 'global' => 'global', |
||
480 | ), |
||
481 | 'module' => 'flag_abuse_reason', |
||
482 | 'api_version' => 2, |
||
483 | ); |
||
484 | |||
485 | // Exported flag: "Comment Abuse 3". |
||
486 | $flags[] = array ( |
||
487 | 'content_type' => 'comment', |
||
488 | 'name' => 'abuse_comment_3', |
||
489 | 'title' => 'Comment Abuse 3', |
||
490 | 'global' => false, |
||
491 | 'types' => array ( |
||
492 | '0' => 'forum', |
||
493 | '1' => 'news', |
||
494 | '2' => 'team_forum', |
||
495 | ), |
||
496 | 'events' => array ( |
||
497 | 0 => 'flag', |
||
498 | 1 => 'unflag', |
||
499 | ), |
||
500 | 'flag_short' => 'Flag as offensive', |
||
501 | 'flag_long' => 'Flag this content as offensive.', |
||
502 | 'flag_message' => '', |
||
503 | 'unflag_short' => 'Flag as non-offensive', |
||
504 | 'unflag_long' => 'Flag this content as non-offensive.', |
||
505 | 'unflag_message' => '', |
||
506 | 'unflag_denied_text' => '', |
||
507 | 'link_type' => 'confirm', |
||
508 | 'roles' => array ( |
||
509 | 'flag' => array ( |
||
510 | 0 => '2', |
||
511 | ), |
||
512 | 'unflag' => array ( |
||
513 | 0 => '2', |
||
514 | ), |
||
515 | ), |
||
516 | 'access_author' => '', |
||
517 | 'show_on_comment' => true, |
||
518 | 'flag_confirmation' => 'Are you sure you want to flag this content as offensive?', |
||
519 | 'unflag_confirmation' => 'Are you sure you want to flag this content as non-offensive?', |
||
520 | 'reset_short' => 'Reset flags', |
||
521 | 'reset_long' => 'Reset all flags on this comment', |
||
522 | 'reset_confirmation' => 'Are you sure you want to reset all flags on this comment?', |
||
523 | 'status' => false, |
||
524 | 'show_on_teaser' => false, |
||
525 | 'locked' => array ( |
||
526 | 'name' => 'name', |
||
527 | 'global' => 'global', |
||
528 | ), |
||
529 | 'module' => 'flag_abuse_reason', |
||
530 | 'api_version' => 2, |
||
531 | ); |
||
532 | |||
533 | // Exported flag: "Comment Abuse 4". |
||
534 | $flags[] = array ( |
||
535 | 'content_type' => 'comment', |
||
536 | 'name' => 'abuse_comment_4', |
||
537 | 'title' => 'Comment Abuse 4', |
||
538 | 'global' => false, |
||
539 | 'types' => array ( |
||
540 | '0' => 'forum', |
||
541 | '1' => 'news', |
||
542 | '2' => 'team_forum', |
||
543 | ), |
||
544 | 'events' => array ( |
||
545 | 0 => 'flag', |
||
546 | 1 => 'unflag', |
||
547 | ), |
||
548 | 'flag_short' => 'Flag as offensive', |
||
549 | 'flag_long' => 'Flag this content as offensive.', |
||
550 | 'flag_message' => '', |
||
551 | 'unflag_short' => 'Flag as non-offensive', |
||
552 | 'unflag_long' => 'Flag this content as non-offensive.', |
||
553 | 'unflag_message' => '', |
||
554 | 'unflag_denied_text' => '', |
||
555 | 'link_type' => 'confirm', |
||
556 | 'roles' => array ( |
||
557 | 'flag' => array ( |
||
558 | 0 => '2', |
||
559 | ), |
||
560 | 'unflag' => array ( |
||
561 | 0 => '2', |
||
562 | ), |
||
563 | ), |
||
564 | 'access_author' => '', |
||
565 | 'show_on_comment' => true, |
||
566 | 'flag_confirmation' => 'Are you sure you want to flag this content as offensive?', |
||
567 | 'unflag_confirmation' => 'Are you sure you want to flag this content as non-offensive?', |
||
568 | 'reset_short' => 'Reset flags', |
||
569 | 'reset_long' => 'Reset all flags on this comment', |
||
570 | 'reset_confirmation' => 'Are you sure you want to reset all flags on this comment?', |
||
571 | 'status' => false, |
||
572 | 'show_on_teaser' => false, |
||
573 | 'locked' => array ( |
||
574 | 'name' => 'name', |
||
575 | 'global' => 'global', |
||
576 | ), |
||
577 | 'module' => 'flag_abuse_reason', |
||
578 | 'api_version' => 2, |
||
579 | ); |
||
580 | |||
581 | // Exported flag: "Comment Abuse 5". |
||
582 | $flags[] = array ( |
||
583 | 'content_type' => 'comment', |
||
584 | 'name' => 'abuse_comment_5', |
||
585 | 'title' => 'Comment Abuse 5', |
||
586 | 'global' => false, |
||
587 | 'types' => array ( |
||
588 | '0' => 'forum', |
||
589 | '1' => 'news', |
||
590 | '2' => 'team_forum', |
||
591 | ), |
||
592 | 'events' => array ( |
||
593 | 0 => 'flag', |
||
594 | 1 => 'unflag', |
||
595 | ), |
||
596 | 'flag_short' => 'Flag as offensive', |
||
597 | 'flag_long' => 'Flag this content as offensive.', |
||
598 | 'flag_message' => '', |
||
599 | 'unflag_short' => 'Flag as non-offensive', |
||
600 | 'unflag_long' => 'Flag this content as non-offensive.', |
||
601 | 'unflag_message' => '', |
||
602 | 'unflag_denied_text' => '', |
||
603 | 'link_type' => 'confirm', |
||
604 | 'roles' => array ( |
||
605 | 'flag' => array ( |
||
606 | 0 => '2', |
||
607 | ), |
||
608 | 'unflag' => array ( |
||
609 | 0 => '2', |
||
610 | ), |
||
611 | ), |
||
612 | 'access_author' => '', |
||
613 | 'show_on_comment' => true, |
||
614 | 'flag_confirmation' => 'Are you sure you want to flag this content as offensive?', |
||
615 | 'unflag_confirmation' => 'Are you sure you want to flag this content as non-offensive?', |
||
616 | 'reset_short' => 'Reset flags', |
||
617 | 'reset_long' => 'Reset all flags on this comment', |
||
618 | 'reset_confirmation' => 'Are you sure you want to reset all flags on this comment?', |
||
619 | 'status' => false, |
||
620 | 'show_on_teaser' => false, |
||
621 | 'locked' => array ( |
||
622 | 'name' => 'name', |
||
623 | 'global' => 'global', |
||
624 | ), |
||
625 | 'module' => 'flag_abuse_reason', |
||
626 | 'api_version' => 2, |
||
627 | ); |
||
628 | |||
629 | return $flags; |
||
630 | } |
||
863 |