Code Duplication    Length = 20-20 lines in 4 locations

class/hotelpromotion.php 1 location

@@ 225-244 (lines=20) @@
222
     * @param bool   $force
223
     * @return bool|void
224
     */
225
    public function delete(&$promotion, $force = false)
226
    {
227
        if (strtolower(get_class($promotion)) !== 'martinhotelpromotion') {
228
            return false;
229
        }
230
231
        $sql = "DELETE FROM " . $this->db->prefix("martin_hotel_promotions") . " WHERE promotion_id = " . $promotion->promotion_id();
232
233
        if (false != $force) {
234
            $result = $this->db->queryF($sql);
235
        } else {
236
            $result = $this->db->query($sql);
237
        }
238
239
        if (!$result) {
240
            return false;
241
        }
242
243
        return true;
244
    }
245
246
    /**
247
     * delete hotel cities matching a set of conditions

class/hotelservice.php 1 location

@@ 230-249 (lines=20) @@
227
     * @param bool   $force
228
     * @return bool|void
229
     */
230
    public function delete(&$hotelservice, $force = false)
231
    {
232
        if (strtolower(get_class($hotelservice)) !== 'martinhotelservice') {
233
            return false;
234
        }
235
236
        $sql = "DELETE FROM " . $this->db->prefix("martin_hotel_service") . " WHERE service_id = " . $hotelservice->service_id();
237
238
        if (false != $force) {
239
            $result = $this->db->queryF($sql);
240
        } else {
241
            $result = $this->db->query($sql);
242
        }
243
244
        if (!$result) {
245
            return false;
246
        }
247
248
        return true;
249
    }
250
251
    /**
252
     * delete hotel cities matching a set of conditions

class/hotelservicetype.php 1 location

@@ 183-202 (lines=20) @@
180
     * @param bool   $force
181
     * @return bool|void
182
     */
183
    public function delete(&$hotelservicetype, $force = false)
184
    {
185
        if (strtolower(get_class($hotelservicetype)) !== 'martinhotelservicetype') {
186
            return false;
187
        }
188
189
        $sql = "DELETE FROM " . $this->db->prefix("martin_hotel_service_type") . " WHERE service_type_id = " . $hotelservicetype->service_type_id();
190
191
        if (false != $force) {
192
            $result = $this->db->queryF($sql);
193
        } else {
194
            $result = $this->db->query($sql);
195
        }
196
197
        if (!$result) {
198
            return false;
199
        }
200
201
        return true;
202
    }
203
204
    /**
205
     * delete hotel cities matching a set of conditions

class/room.php 1 location

@@ 375-394 (lines=20) @@
372
     * @param bool   $force
373
     * @return bool|void
374
     */
375
    public function delete(&$room, $force = false)
376
    {
377
        if (strtolower(get_class($room)) !== 'martinroom') {
378
            return false;
379
        }
380
381
        $sql = "DELETE FROM " . $this->db->prefix("martin_room") . " WHERE room_id = " . $room->room_id();
382
383
        if (false != $force) {
384
            $result = $this->db->queryF($sql);
385
        } else {
386
            $result = $this->db->query($sql);
387
        }
388
389
        if (!$result) {
390
            return false;
391
        }
392
393
        return true;
394
    }
395
396
    /**
397
     * count room matching a condition