Code Duplication    Length = 12-13 lines in 4 locations

class/hotelservice.php 2 locations

@@ 474-486 (lines=13) @@
471
     * @param int $hotel_id
472
     * @return array
473
     */
474
    public function getHotelList($hotel_id = 0)
475
    {
476
        $rows = array();
477
        $sql  = "SELECT hotel_id ,hotel_name FROM " . $this->db->prefix("martin_hotel");
478
        $sql .= $hotel_id > 0 ? " WHERE hotel_id = $hotel_id" : "";
479
        $sql .= " order BY hotel_rank ,hotel_id DESC ";
480
        $result = $this->db->query($sql);
481
        while ($row = $this->db->fetchArray($result)) {
482
            $rows[$row['hotel_id']] = $row['hotel_name'];
483
        }
484
485
        return $rows;
486
    }
487
488
    /**
489
     * @get       service list
@@ 497-508 (lines=12) @@
494
     * @param int $service_id
495
     * @return array
496
     */
497
    public function getServiceList($service_id = 0)
498
    {
499
        $rows = array();
500
        $sql  = "SELECT service_id ,service_name FROM " . $this->db->prefix("martin_hotel_service");
501
        $sql .= $hotel_id > 0 ? " WHERE service_id = $service_id" : "";
502
        $result = $this->db->query($sql);
503
        while ($row = $this->db->fetchArray($result)) {
504
            $rows[$row['service_id']] = $row['service_name'];
505
        }
506
507
        return $rows;
508
    }
509
510
    /**
511
     * @get       relation count

class/room.php 2 locations

@@ 481-492 (lines=12) @@
478
     * @param int $room_type_id
479
     * @return array
480
     */
481
    public function getRoomTypeList($room_type_id = 0)
482
    {
483
        $rows = array();
484
        $sql  = "SELECT * FROM " . $this->db->prefix("martin_room_type");
485
        $sql .= $room_type_id > 0 ? " WHERE room_type_id = $room_type_id" : "";
486
        $result = $this->db->query($sql);
487
        while ($row = $this->db->fetchArray($result)) {
488
            $rows[$row['room_type_id']] = $row['room_type_info'];
489
        }
490
491
        return $rows;
492
    }
493
494
    /**
495
     * @get       room type list
@@ 503-514 (lines=12) @@
500
     * @param int $room_id
501
     * @return array
502
     */
503
    public function getRoomList($room_id = 0)
504
    {
505
        $rows = array();
506
        $sql  = "SELECT room_id,room_name FROM " . $this->db->prefix("martin_room");
507
        $sql .= $room_id > 0 ? " WHERE room_id = $room_id" : "";
508
        $result = $this->db->query($sql);
509
        while ($row = $this->db->fetchArray($result)) {
510
            $rows[$row['room_id']] = $row['room_name'];
511
        }
512
513
        return $rows;
514
    }
515
516
    /**
517
     * insert update room type