gocodebox/lifterlms

View on GitHub
includes/functions/llms.functions.user.postmeta.php

Summary

Maintainability
B
6 hrs
Test Coverage
A
95%

Function llms_get_user_postmeta has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    function llms_get_user_postmeta( $user_id, $post_id, $meta_key = null, $single = true, $return = 'meta_value' ) {

        $single = is_null( $meta_key ) ? false : $single;

        $res = array();
Severity: Minor
Found in includes/functions/llms.functions.user.postmeta.php - About 1 hr 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 llms_delete_user_postmeta has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    function llms_delete_user_postmeta( $user_id, $post_id, $meta_key = null, $meta_value = null ) {

        $ret = false;

        $existing = _llms_query_user_postmeta( $user_id, $post_id, $meta_key, maybe_unserialize( $meta_value ) );
Severity: Minor
Found in includes/functions/llms.functions.user.postmeta.php - About 1 hr 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 llms_update_user_postmeta has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    function llms_update_user_postmeta( $user_id, $post_id, $meta_key, $meta_value, $unique = true ) {

        $item = false;

        // if unique is true, make an update to the existing item (if it exists).
Severity: Minor
Found in includes/functions/llms.functions.user.postmeta.php - About 1 hr 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 llms_bulk_delete_user_postmeta has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    function llms_bulk_delete_user_postmeta( $user_id, $post_id, $data = array() ) {

        $res = array_fill_keys( array_keys( $data ), null );
        $err = false;

Severity: Minor
Found in includes/functions/llms.functions.user.postmeta.php - About 1 hr 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

Method llms_get_user_postmeta has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    function llms_get_user_postmeta( $user_id, $post_id, $meta_key = null, $single = true, $return = 'meta_value' ) {
Severity: Minor
Found in includes/functions/llms.functions.user.postmeta.php - About 35 mins to fix

    Method llms_update_user_postmeta has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        function llms_update_user_postmeta( $user_id, $post_id, $meta_key, $meta_value, $unique = true ) {
    Severity: Minor
    Found in includes/functions/llms.functions.user.postmeta.php - About 35 mins to fix

      There are no issues that match your filters.

      Category
      Status