gocodebox/lifterlms

View on GitHub
includes/class-llms-engagement-handler.php

Summary

Maintainability
B
5 hrs
Test Coverage
A
97%

Method dupcheck has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private static function dupcheck( $type, $user_id, $template_id, $related_id = '', $engagement_id = null ) {

        $student = llms_get_student( $user_id );

        $query = new LLMS_Awards_Query(
Severity: Minor
Found in includes/class-llms-engagement-handler.php - About 1 hr to fix

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

        public static function create_actions( $type, $user_id, $generated_id, $related_id = '', $engagement_id = null ) {
    Severity: Minor
    Found in includes/class-llms-engagement-handler.php - About 35 mins to fix

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

          private static function create( $type, $user_id, $template_id, $related_id = '', $engagement_id = null ) {
      Severity: Minor
      Found in includes/class-llms-engagement-handler.php - About 35 mins to fix

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

            public static function do_deprecated_filter( $args, $init_args, $type, $deprecated, $replacement ) {
        Severity: Minor
        Found in includes/class-llms-engagement-handler.php - About 35 mins to fix

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

              private static function can_process( $type, $user_id, $template_id, $related_id = '', $engagement_id = null ) {
          Severity: Minor
          Found in includes/class-llms-engagement-handler.php - About 35 mins to fix

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

                private static function dupcheck( $type, $user_id, $template_id, $related_id = '', $engagement_id = null ) {
            Severity: Minor
            Found in includes/class-llms-engagement-handler.php - About 35 mins to fix

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

                  private static function can_process( $type, $user_id, $template_id, $related_id = '', $engagement_id = null ) {
              
                      /**
                       * Skip engagement processing checks and force engagements to process.
                       *
              Severity: Minor
              Found in includes/class-llms-engagement-handler.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 handle_email has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function handle_email( $args ) {
              
                      $can_process = self::can_process( 'email', ...$args );
                      if ( true !== $can_process ) {
                          return $can_process;
              Severity: Minor
              Found in includes/class-llms-engagement-handler.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

              There are no issues that match your filters.

              Category
              Status