Code Duplication    Length = 15-20 lines in 2 locations

plugin/advanced_subscription/src/AdvancedSubscriptionPlugin.php 1 location

@@ 948-967 (lines=20) @@
945
    {
946
        $userId = intval($userId);
947
        $sessionId = intval($sessionId);
948
        if (!empty($userId) && !empty($sessionId)) {
949
            $queueTable = Database::get_main_table(TABLE_ADVANCED_SUBSCRIPTION_QUEUE);
950
            $row = Database::select(
951
                'status',
952
                $queueTable,
953
                array(
954
                    'where' => array(
955
                        'user_id = ? AND session_id = ?' => array($userId, $sessionId),
956
                    )
957
                )
958
            );
959
960
            if (count($row) == 1) {
961
962
                return $row[0]['status'];
963
            } else {
964
965
                return ADVANCED_SUBSCRIPTION_QUEUE_STATUS_NO_QUEUE;
966
            }
967
        }
968
969
        return false;
970
    }

main/inc/lib/api.lib.php 1 location

@@ 1609-1623 (lines=15) @@
1606
 */
1607
function api_get_course_int_id($code = null)
1608
{
1609
    if (!empty($code)) {
1610
        $code = Database::escape_string($code);
1611
        $row = Database::select(
1612
            'id',
1613
            Database::get_main_table(TABLE_MAIN_COURSE),
1614
            array('where'=> array('code = ?' => array($code))),
1615
            'first'
1616
        );
1617
1618
        if (is_array($row) && isset($row['id'])) {
1619
            return $row['id'];
1620
        } else {
1621
            return false;
1622
        }
1623
    }
1624
    return Session::read('_real_cid', 0);
1625
}
1626