Code Duplication    Length = 16-21 lines in 2 locations

includes/class-sensei-utils.php 2 locations

@@ 1396-1416 (lines=21) @@
1393
				$user_id = get_current_user_id();
1394
			}
1395
1396
            if ( ! $user_id > 0 ) {
1397
1398
	            $user_started_course =  false;
1399
1400
            } else {
1401
1402
	            $activity_args = array(
1403
		            'post_id' => $course_id,
1404
		            'user_id' => $user_id,
1405
		            'type' => 'sensei_course_status',
1406
		            'field' => 'comment_ID'
1407
	            );
1408
1409
				$user_course_status_id = Sensei_Utils::sensei_get_activity_value( $activity_args );
1410
1411
				if ( $user_course_status_id ) {
1412
1413
					$user_started_course = $user_course_status_id;
1414
1415
				}
1416
            }
1417
		}
1418
1419
		/**
@@ 1599-1614 (lines=16) @@
1596
	 */
1597
	public static function user_started_lesson( $lesson_id = 0, $user_id = 0 ) {
1598
1599
		if( $lesson_id ) {
1600
			if( ! $user_id ) {
1601
				$user_id = get_current_user_id();
1602
			}
1603
1604
            $activity_args = array(
1605
                'post_id' => $lesson_id,
1606
                'user_id' => $user_id,
1607
                'type' => 'sensei_lesson_status',
1608
                'field' => 'comment_ID' );
1609
1610
			$user_lesson_status_id = Sensei_Utils::sensei_get_activity_value( $activity_args );
1611
			if( $user_lesson_status_id ) {
1612
				return $user_lesson_status_id;
1613
			}
1614
		}
1615
		return false;
1616
	}
1617