madbob/GASdottoNG

View on GitHub
code/app/Aggregate.php

Summary

Maintainability
D
2 days
Test Coverage

File Aggregate.php has 405 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
Severity: Minor
Found in code/app/Aggregate.php - About 5 hrs to fix

    Function computeStrings has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

        public function computeStrings()
        {
            $names = [];
            $dates = [];
    
    
    Severity: Minor
    Found in code/app/Aggregate.php - About 3 hrs 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

    Aggregate has 28 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Aggregate extends Model
    {
        use HasFactory, GASModel, ModifiableTrait, ReducibleTrait, WithinGas;
    
        protected $dispatchesEvents = [
    Severity: Minor
    Found in code/app/Aggregate.php - About 3 hrs to fix

      Function hasChangedProdcts has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          public function hasChangedProdcts()
          {
              $has_changed_products = false;
      
              if ($this->isActive()) {
      Severity: Minor
      Found in code/app/Aggregate.php - About 2 hrs 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 getBookingsAttribute has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getBookingsAttribute()
          {
              $ret = [];
      
              foreach ($this->orders as $order) {
      Severity: Minor
      Found in code/app/Aggregate.php - About 2 hrs 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 computeStrings has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function computeStrings()
          {
              $names = [];
              $dates = [];
      
      
      Severity: Minor
      Found in code/app/Aggregate.php - About 1 hr to fix

        Method getBookingsAttribute has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getBookingsAttribute()
            {
                $ret = [];
        
                foreach ($this->orders as $order) {
        Severity: Minor
        Found in code/app/Aggregate.php - About 1 hr to fix

          Method hasChangedProdcts has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function hasChangedProdcts()
              {
                  $has_changed_products = false;
          
                  if ($this->isActive()) {
          Severity: Minor
          Found in code/app/Aggregate.php - About 1 hr to fix

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

                public function guessGas()
                {
                    $candidates = [];
                    $valid = [];
                    $threshold = $this->orders->count();
            Severity: Minor
            Found in code/app/Aggregate.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 printableUserHeader has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public function printableUserHeader()
                {
                    $ret = $this->printableHeader();
            
                    $user = Auth::user();
            Severity: Minor
            Found in code/app/Aggregate.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

            There are no issues that match your filters.

            Category
            Status