gocodebox/lifterlms

View on GitHub

Showing 1,386 of 1,391 total issues

Function generate_export_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function generate_export_file( $args = array(), $filename = null, $type = 'csv' ) {

        // We only support CSVs and don't allow fakers.
        if ( ! empty( $filename ) && pathinfo( $filename, PATHINFO_EXTENSION ) !== $type ) {
            return false;
Severity: Minor
Found in includes/abstracts/llms.abstract.exportable.admin.table.php - About 25 mins to fix

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 has_prerequisite has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function has_prerequisite( $type = 'any' ) {

        if ( 'yes' === $this->get( 'has_prerequisite' ) ) {

            if ( 'any' === $type ) {
Severity: Minor
Found in includes/models/model.llms.course.php - About 25 mins to fix

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_css has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function get_css( $selectors, $rules, $selector_prefix = '' ) {

        // Convert the $rules array to a list of CSS strings.
        $rules_list = array();
        foreach ( $rules as $prop => $val ) {
Severity: Minor
Found in includes/theme-support/class-llms-theme-support.php - About 25 mins to fix

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 is_valid has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function is_valid( $plan_id ) {

        $msg = false;

        $plan = new LLMS_Access_Plan( $plan_id );
Severity: Minor
Found in includes/models/model.llms.coupon.php - About 25 mins to fix

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_prerequisite_id has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_prerequisite_id( $type = 'course' ) {

        if ( $this->has_prerequisite( $type ) ) {

            switch ( $type ) {
Severity: Minor
Found in includes/models/model.llms.course.php - About 25 mins to fix

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 modify_dom_images has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function modify_dom_images( $dom ) {

        $images    = $dom->getElementsByTagName( 'img' );
        $to_remove = array();

Severity: Minor
Found in includes/class.llms.certificates.php - About 25 mins to fix

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_recurring_payment_due_date_for_scheduler has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_recurring_payment_due_date_for_scheduler( $next_payment_date = false, $gmt = false ) {

        $date = false === $next_payment_date ? $this->get_next_payment_due_date() : $next_payment_date;

        if ( ! $date ) {
Severity: Minor
Found in includes/models/model.llms.order.php - About 25 mins to fix

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 toArrayCustom has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function toArrayCustom( $arr ) {

        // Build an array of keys that are registered or can be excluded as a custom field.
        $props = array_keys( $this->get_properties() );
        foreach ( $props as &$prop ) {
Severity: Minor
Found in includes/abstracts/abstract.llms.post.model.php - About 25 mins to fix

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_columns has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_columns( $context = 'display' ) {

        /**
         * Filters the array of table columns.
         *
Severity: Minor
Found in includes/abstracts/abstract.llms.admin.table.php - About 25 mins to fix

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_schedule_details has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_schedule_details() {

        $ret = '';

        $period    = $this->get( 'period' );
Severity: Minor
Found in includes/models/model.llms.access.plan.php - About 25 mins to fix

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 __construct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct( $question_id, $data_or_id = array() ) {

        // Ensure the question is valid.
        if ( $this->set_question( $question_id ) ) {

Severity: Minor
Found in includes/models/model.llms.question.choice.php - About 25 mins to fix

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_output has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function get_output() {

        // Get a reference to the current page where the shortcode is displayed.
        global $post;
        $current_post = $post;
Severity: Minor
Found in includes/abstracts/abstract.llms.shortcode.course.element.php - About 25 mins to fix

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 buddyboss_compatibility has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function buddyboss_compatibility() {

        if ( ! function_exists( 'is_plugin_active' ) || ! function_exists( 'bp_is_my_profile' ) || bp_is_my_profile() ) {
            return;
        }
Severity: Minor
Found in includes/class.llms.playnice.php - About 25 mins to fix

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 query_associated_courses has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function query_associated_courses() {

        // Start with autoenroll courses.
        $courses = $this->get_auto_enroll_courses();

Severity: Minor
Found in includes/models/model.llms.membership.php - About 25 mins to fix

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_section_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function get_section_data( $sections ) {
    global $post;
    $html = '';
    $args = array(
        'post_type'   => 'section',
Severity: Minor
Found in includes/llms.template.functions.php - About 25 mins to fix

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 parse_args has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function parse_args() {

        // Sanitize post, user, excluded attempts ids.
        foreach ( array( 'student_id', 'quiz_id', 'exclude' ) as $key ) {
            $this->arguments[ $key ] = $this->sanitize_id_array( $this->arguments[ $key ] );
Severity: Minor
Found in includes/class.llms.query.quiz.attempt.php - About 25 mins to fix

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_enrollment_status has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_enrollment_status( $product_id, $use_cache = true ) {

        $status       = false;
        $product_type = get_post_type( $product_id );

Severity: Minor
Found in includes/models/model.llms.student.php - About 25 mins to fix

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 switch_payment_source_setup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function switch_payment_source_setup() {

        $order_id = llms_filter_input( INPUT_POST, 'order_id', FILTER_SANITIZE_NUMBER_INT );
        if ( ! $order_id ) {
            return new WP_Error( 'switch-source-order-missing', __( 'Missing order information.', 'lifterlms' ), 'error' );
Severity: Minor
Found in includes/controllers/class-llms-controller-checkout.php - About 25 mins to fix

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 create_visibilities has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function create_visibilities() {
        foreach ( array_keys( llms_get_access_plan_visibility_options() ) as $term ) {
            if ( ! get_term_by( 'name', $term, 'llms_access_plan_visibility' ) ) {
                wp_insert_term( $term, 'llms_access_plan_visibility' );
            }
Severity: Minor
Found in includes/class.llms.install.php - About 25 mins to fix

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 can_be_manually_graded has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function can_be_manually_graded() {

        $question = $this->get_question();

        if ( $question && $this->get( 'points' ) >= 1 ) {
Severity: Minor
Found in includes/models/model.llms.quiz.attempt.question.php - About 25 mins to fix

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

Severity
Category
Status
Source
Language