Code Duplication    Length = 12-16 lines in 4 locations

core/db_models/EEM_Datetime.model.php 4 locations

@@ 315-327 (lines=13) @@
312
     * @return EE_Datetime[]
313
     * @throws EE_Error
314
     */
315
    public function get_datetimes_for_event_ordered_by_DTT_order(
316
        int $EVT_ID,
317
        bool $include_expired = true,
318
        bool $include_deleted = true,
319
        $limit = 0
320
    ) {
321
        $prev_data_prep_value = $this->prepModelForQuery();
322
        $where_params         = ['Event.EVT_ID' => absint($EVT_ID)];
323
        $query_params[0]      = $this->addDefaultWhereParams($where_params, $include_deleted, $include_expired);
324
        $query_params         = $this->addDefaultWhereConditions($query_params);
325
        $query_params         = $this->addDefaultQueryParams($query_params, $limit, 'DTT_order');
326
        return $this->getDatetimesAndRestoreModel($query_params, $prev_data_prep_value);
327
    }
328
329
330
    /**
@@ 416-431 (lines=16) @@
413
     * @return EE_Datetime[]
414
     * @throws EE_Error
415
     */
416
    public function get_datetimes_for_event_ordered_by_start_time(
417
        int $EVT_ID,
418
        bool $include_expired = true,
419
        bool $include_deleted = true,
420
        $limit = 0
421
    ) {
422
        $prev_data_prep_value = $this->prepModelForQuery();
423
        $where_params         = ['Event.EVT_ID' => absint($EVT_ID)];
424
        $query_params[0]      = $this->addDefaultWhereParams($where_params, $include_deleted, $include_expired);
425
        $query_params         = $this->addDefaultWhereConditions(
426
            $query_params,
427
            EEM_Base::default_where_conditions_this_only
428
        );
429
        $query_params         = $this->addDefaultQueryParams($query_params, $limit, 'DTT_order');
430
        return $this->getDatetimesAndRestoreModel($query_params, $prev_data_prep_value);
431
    }
432
433
434
    /**
@@ 445-456 (lines=12) @@
442
     * @return EE_Datetime[]
443
     * @throws EE_Error
444
     */
445
    public function get_datetimes_for_ticket_ordered_by_start_time(
446
        int $TKT_ID,
447
        bool $include_expired = true,
448
        bool $include_deleted = true,
449
        $limit = 0
450
    ) {
451
        $prev_data_prep_value = $this->prepModelForQuery();
452
        $where_params         = ['Ticket.TKT_ID' => absint($TKT_ID)];
453
        $query_params[0]      = $this->addDefaultWhereParams($where_params, $include_deleted, $include_expired);
454
        $query_params         = $this->addDefaultQueryParams($query_params, $limit);
455
        return $this->getDatetimesAndRestoreModel($query_params, $prev_data_prep_value);
456
    }
457
458
459
    /**
@@ 471-482 (lines=12) @@
468
     * @return EE_Datetime[]
469
     * @throws EE_Error
470
     */
471
    public function get_datetimes_for_ticket_ordered_by_DTT_order(
472
        int $TKT_ID,
473
        bool $include_expired = true,
474
        bool $include_deleted = true,
475
        $limit = 0
476
    ) {
477
        $prev_data_prep_value = $this->prepModelForQuery();
478
        $where_params         = ['Ticket.TKT_ID' => absint($TKT_ID)];
479
        $query_params[0]      = $this->addDefaultWhereParams($where_params, $include_deleted, $include_expired);
480
        $query_params         = $this->addDefaultQueryParams($query_params, $limit, 'DTT_order');
481
        return $this->getDatetimesAndRestoreModel($query_params, $prev_data_prep_value);
482
    }
483
484
485
    /**