Code Duplication    Length = 10-11 lines in 4 locations

class/answer.php 1 location

@@ 535-544 (lines=10) @@
532
        if (!$result) {
533
            return $ret;
534
        }
535
        while ($myrow = $this->db->fetchArray($result)) {
536
            $answer = new sfAnswer();
537
            $answer->assignVars($myrow);
538
            if (!$id_as_key) {
539
                $ret[] =& $answer;
540
            } else {
541
                $ret[$myrow['answerid']] =& $answer;
542
            }
543
            unset($answer);
544
        }
545
546
        return $ret;
547
    }

class/category.php 1 location

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

class/faq.php 2 locations

@@ 876-886 (lines=11) @@
873
            return false;
874
        }
875
876
        while ($myrow = $this->db->fetchArray($result)) {
877
            $faq = new sfFaq();
878
            $faq->assignVars($myrow);
879
880
            if (!$id_as_key) {
881
                $ret[] = &$faq;
882
            } else {
883
                $ret[$myrow['faqid']] = &$faq;
884
            }
885
            unset($faq);
886
        }
887
888
        return $ret;
889
    }
@@ 955-965 (lines=11) @@
952
            return false;
953
        }
954
955
        while ($myrow = $this->db->fetchArray($result)) {
956
            $faq = new sfFaq();
957
            $faq->assignVars($myrow);
958
959
            if (!$id_as_key) {
960
                $ret[] = &$faq;
961
            } else {
962
                $ret[$myrow['faqid']] = &$faq;
963
            }
964
            unset($faq);
965
        }
966
967
        return $ret;
968