Code Duplication    Length = 7-7 lines in 2 locations

class/hotel.php 2 locations

@@ 573-579 (lines=7) @@
570
     */
571
    public function getCount($searchData)
572
    {
573
        if (!empty($searchData) && is_array($searchData)) {
574
            $where = 'where 1 = 1 ';
575
            //$where .= !empty($searchData['hotel_city_id']) ? " and h.hotel_city_id = {$searchData['hotel_city_id']} " : " ";
576
            $where .= !empty($searchData['hotel_city_id']) ? " and h.hotel_city_id LIKE  '%{$searchData['hotel_city_id']}%' " : " ";
577
            $where .= !empty($searchData['hotel_star']) ? " and h.hotel_star = {$searchData['hotel_star']} " : " ";
578
            $where .= !empty($searchData['hotel_name']) ? " and h.hotel_name like '%{$searchData['hotel_name']}%' " : " ";
579
        }
580
        $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('martin_hotel') . " h $where";
581
        if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
582
            $sql .= ' ' . $criteria->renderWhere();
@@ 661-667 (lines=7) @@
658
     */
659
    public function getHotelList($searchData, $limit = 0, $start = 0, $sort = 'hotel_id')
660
    {
661
        if (!empty($searchData) && is_array($searchData)) {
662
            $where = 'where 1 = 1 ';
663
            //$where .= !empty($searchData['hotel_city_id']) ? " and h.hotel_city_id = {$searchData['hotel_city_id']} " : " ";
664
            $where .= !empty($searchData['hotel_city_id']) ? " and h.hotel_city_id LIKE '%{$searchData['hotel_city_id']}%' " : " ";
665
            $where .= !empty($searchData['hotel_star']) ? " and h.hotel_star = {$searchData['hotel_star']} " : " ";
666
            $where .= !empty($searchData['hotel_name']) ? " and h.hotel_name like '%{$searchData['hotel_name']}%' " : " ";
667
        }
668
        $sql = "SELECT h.* FROM " . $this->db->prefix("martin_hotel") . " h ";
669
        //left join ".$this->db->prefix("martin_hotel_city")." hc ON (hc.city_id IN ( h.hotel_city_id ) )
670
        //$sql .=    "$where    Group BY h.hotel_id order BY h.hotel_rank ,h.hotel_id DESC ";