File class.llms.admin.builder.php
has 673 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* LifterLMS Admin Course Builder
*
* @package LifterLMS/Admin/Classes
Function update_lessons
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
private static function update_lessons( $lessons, $section ) {
$ret = array();
foreach ( $lessons as $lesson_data ) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function update_custom_schemas
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
public static function update_custom_schemas( $type, $post, $post_data ) {
$schemas = self::get_custom_schemas();
if ( empty( $schemas[ $type ] ) ) {
return;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function get_existing_posts
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
private static function get_existing_posts( $post_type = '', $search_term = '', $page = 1 ) {
$args = array(
'order' => 'ASC',
'orderby' => 'post_title',
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function update_questions
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
private static function update_questions( $questions, $parent ) {
$res = array();
foreach ( $questions as $q_data ) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method output
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function output() {
global $post;
$course_id = isset( $_GET['course_id'] ) ? absint( $_GET['course_id'] ) : null;
Method get_existing_posts
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function get_existing_posts( $post_type = '', $search_term = '', $page = 1 ) {
$args = array(
'order' => 'ASC',
'orderby' => 'post_title',
Method update_lessons
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function update_lessons( $lessons, $section ) {
$ret = array();
foreach ( $lessons as $lesson_data ) {
LLMS_Admin_Builder
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class LLMS_Admin_Builder {
/**
* Search term string used by `get_existing_posts_where()` when querying for existing posts to clone/add to a course.
*
Method update_questions
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function update_questions( $questions, $parent ) {
$res = array();
foreach ( $questions as $q_data ) {
Method handle_ajax
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function handle_ajax( $request ) {
if ( ! $request['course_id'] || ! current_user_can( 'edit_course', $request['course_id'] ) ) {
return array();
}
Function update_quiz
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private static function update_quiz( $quiz_data, $lesson ) {
$res = array_merge(
$quiz_data,
array(
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function heartbeat_received
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public static function heartbeat_received( $res, $data ) {
// Exit if there's no builder data in the heartbeat data.
if ( empty( $data['llms_builder'] ) ) {
return $res;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function process_detachments
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private static function process_detachments( $data ) {
$ret = array();
foreach ( $data['detach'] as $id ) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function handle_ajax
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public static function handle_ajax( $request ) {
if ( ! $request['course_id'] || ! current_user_can( 'edit_course', $request['course_id'] ) ) {
return array();
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function update_section
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private static function update_section( $section_data, $course_id ) {
$res = array_merge(
$section_data,
array(
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method update_quiz
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function update_quiz( $quiz_data, $lesson ) {
$res = array_merge(
$quiz_data,
array(
Method process_detachments
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function process_detachments( $data ) {
$ret = array();
foreach ( $data['detach'] as $id ) {
Method update_custom_schemas
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function update_custom_schemas( $type, $post, $post_data ) {
$schemas = self::get_custom_schemas();
if ( empty( $schemas[ $type ] ) ) {
return;
Method heartbeat_received
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function heartbeat_received( $res, $data ) {
// Exit if there's no builder data in the heartbeat data.
if ( empty( $data['llms_builder'] ) ) {
return $res;
Method get_custom_schemas
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function get_custom_schemas() {
$quiz_fields = array();
/**
Method update_section
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function update_section( $section_data, $course_id ) {
$res = array_merge(
$section_data,
array(
Function process_updates
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static function process_updates( $data ) {
$ret = array();
if ( ! empty( $data['updates']['sections'] ) && is_array( $data['updates']['sections'] ) ) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function output
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function output() {
global $post;
$course_id = isset( $_GET['course_id'] ) ? absint( $_GET['course_id'] ) : null;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"