Code Duplication    Length = 14-15 lines in 2 locations

core/db_classes/EE_Ticket.class.php 1 location

@@ 1563-1576 (lines=14) @@
1560
     * @throws EE_Error
1561
     * @throws ReflectionException
1562
     */
1563
    public function update_tickets_sold()
1564
    {
1565
        $count_regs_for_this_ticket = $this->count_registrations(
1566
            [
1567
                [
1568
                    'STS_ID'      => EEM_Registration::status_id_approved,
1569
                    'REG_deleted' => 0,
1570
                ],
1571
            ]
1572
        );
1573
        $this->set_sold($count_regs_for_this_ticket);
1574
        $this->save();
1575
        return $count_regs_for_this_ticket;
1576
    }
1577
1578
1579
    /**

core/db_classes/EE_Datetime.class.php 1 location

@@ 1307-1321 (lines=15) @@
1304
     * @throws InvalidDataTypeException
1305
     * @throws EE_Error
1306
     */
1307
    public function update_sold()
1308
    {
1309
        $count_regs_for_this_datetime = EEM_Registration::instance()->count(
1310
            array(
1311
                array(
1312
                    'STS_ID'                 => EEM_Registration::status_id_approved,
1313
                    'REG_deleted'            => 0,
1314
                    'Ticket.Datetime.DTT_ID' => $this->ID(),
1315
                ),
1316
            )
1317
        );
1318
        $this->set_sold($count_regs_for_this_datetime);
1319
        $this->save();
1320
        return $count_regs_for_this_datetime;
1321
    }
1322
1323
1324
    /*******************************************************************