Code Duplication    Length = 8-10 lines in 6 locations

src/Fwlib/Db/SqlGenerator.php 6 locations

@@ 558-565 (lines=8) @@
555
     * @param   mixed   $param
556
     * @return  string
557
     */
558
    public function setDelete($param)
559
    {
560
        $this->paramPart['DELETE'] = $param;
561
562
        $this->sqlPart['DELETE'] = 'DELETE FROM ' . $param;
563
564
        return $this->sqlPart['DELETE'];
565
    }
566
567
568
    /**
@@ 593-600 (lines=8) @@
590
     * @param   mixed   $param
591
     * @return  string
592
     */
593
    public function setGroupby($param)
594
    {
595
        $this->paramPart['GROUPBY'] = $param;
596
597
        $this->sqlPart['GROUPBY'] = ' GROUP BY ' . $this->genSqlArray($param);
598
599
        return $this->sqlPart['GROUPBY'];
600
    }
601
602
603
    /**
@@ 609-618 (lines=10) @@
606
     * @param   mixed   $param
607
     * @return  string
608
     */
609
    public function setHaving($param)
610
    {
611
        $this->paramPart['HAVING'] = $param;
612
613
        // Add '(' to defend sql injection
614
        $this->sqlPart['HAVING'] = ' HAVING ('
615
            . $this->genSqlArray($param, ') AND (') . ')';
616
617
        return $this->sqlPart['HAVING'];
618
    }
619
620
621
    /**
@@ 670-677 (lines=8) @@
667
     * @param   mixed   $param
668
     * @return  string
669
     */
670
    public function setOrderby($param)
671
    {
672
        $this->paramPart['ORDERBY'] = $param;
673
674
        $this->sqlPart['ORDERBY'] = ' ORDER BY ' . $this->genSqlArray($param);
675
676
        return $this->sqlPart['ORDERBY'];
677
    }
678
679
680
    /**
@@ 702-711 (lines=10) @@
699
     * @param   mixed   $param
700
     * @return  string
701
     */
702
    public function setSet($param)
703
    {
704
        $this->paramPart['SET'] = $param;
705
706
        // For UPDATE only, INSERT uses VALUES
707
        // User give param array(col => value)
708
        $this->sqlPart['SET'] = $this->genSqlArraySet($param);
709
710
        return $this->sqlPart['SET'];
711
    }
712
713
714
    /**
@@ 757-766 (lines=10) @@
754
     * @param   mixed   $param
755
     * @return  string
756
     */
757
    public function setWhere($param)
758
    {
759
        $this->paramPart['WHERE'] = $param;
760
761
        // Add '(' to defend sql injection
762
        $this->sqlPart['WHERE'] = ' WHERE ('
763
            . $this->genSqlArray($param, ') AND (') . ')';
764
765
        return $this->sqlPart['WHERE'];
766
    }
767
}
768