Code Duplication    Length = 10-11 lines in 4 locations

class/answer.php 1 location

@@ 579-588 (lines=10) @@
576
        if (!$result) {
577
            return $ret;
578
        }
579
        while ($myrow = $this->db->fetchArray($result)) {
580
            $answer = new sfAnswer();
581
            $answer->assignVars($myrow);
582
            if (!$id_as_key) {
583
                $ret[] =& $answer;
584
            } else {
585
                $ret[$myrow['answerid']] =& $answer;
586
            }
587
            unset($answer);
588
        }
589
590
        return $ret;
591
    }

class/category.php 1 location

@@ 430-439 (lines=10) @@
427
            return $ret;
428
        }
429
430
        while ($myrow = $this->db->fetchArray($result)) {
431
            $category = new sfCategory();
432
            $category->assignVars($myrow);
433
            if (!$id_as_key) {
434
                $ret[] = $category;
435
            } else {
436
                $ret[$myrow['categoryid']] = $category;
437
            }
438
            unset($category);
439
        }
440
441
        return $ret;
442
    }

class/faq.php 2 locations

@@ 892-902 (lines=11) @@
889
            return false;
890
        }
891
892
        while ($myrow = $this->db->fetchArray($result)) {
893
            $faq = new sfFaq();
894
            $faq->assignVars($myrow);
895
896
            if (!$id_as_key) {
897
                $ret[] = &$faq;
898
            } else {
899
                $ret[$myrow['faqid']] = &$faq;
900
            }
901
            unset($faq);
902
        }
903
904
        return $ret;
905
    }
@@ 971-981 (lines=11) @@
968
            return false;
969
        }
970
971
        while ($myrow = $this->db->fetchArray($result)) {
972
            $faq = new sfFaq();
973
            $faq->assignVars($myrow);
974
975
            if (!$id_as_key) {
976
                $ret[] = &$faq;
977
            } else {
978
                $ret[$myrow['faqid']] = &$faq;
979
            }
980
            unset($faq);
981
        }
982
983
        return $ret;
984