gocodebox/lifterlms

View on GitHub
includes/admin/class.llms.admin.addons.php

Summary

Maintainability
B
6 hrs
Test Coverage
F
0%

Function handle_manage_addons has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    private function handle_manage_addons() {

        // phpcs:disable WordPress.Security.NonceVerification.Missing -- nonce is verified in $this->handle_actions() method.

        $actions = apply_filters(
Severity: Minor
Found in includes/admin/class.llms.admin.addons.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 output has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function output() {

        if ( is_wp_error( $this->get_data() ) ) {
            _e( 'There was an error retrieving add-ons. Please try again.', 'lifterlms' );
            return;
Severity: Minor
Found in includes/admin/class.llms.admin.addons.php - About 1 hr to fix

    Method handle_manage_addons has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function handle_manage_addons() {
    
            // phpcs:disable WordPress.Security.NonceVerification.Missing -- nonce is verified in $this->handle_actions() method.
    
            $actions = apply_filters(
    Severity: Minor
    Found in includes/admin/class.llms.admin.addons.php - About 1 hr to fix

      Function get_data has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          private function get_data() {
      
              $this->data = llms_get_add_ons();
      
              if ( ! is_wp_error( $this->data ) ) {
      Severity: Minor
      Found in includes/admin/class.llms.admin.addons.php - About 55 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_products_for_cat has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          private function get_products_for_cat( $cat, $include_bundles = true ) {
      
              $products = array();
      
              foreach ( $this->data['items'] as $item ) {
      Severity: Minor
      Found in includes/admin/class.llms.admin.addons.php - About 35 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_product_from_cat has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function get_product_from_cat( $cat, $excludes ) {
      
              $addons = $this->get_products_for_cat( $cat, true );
              shuffle( $addons );
      
      
      Severity: Minor
      Found in includes/admin/class.llms.admin.addons.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