madbob/GASdottoNG

View on GitHub
code/app/Order.php

Summary

Maintainability
F
3 days
Test Coverage

File Order.php has 651 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
Severity: Major
Found in code/app/Order.php - About 1 day to fix

    Order has 47 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Order extends Model
    {
        use HasFactory, TracksUpdater, AttachableTrait, ExportableTrait, ModifiableTrait, PayableTrait, CreditableTrait, GASModel, SluggableID, ReducibleTrait;
    
        public $incrementing = false;
    Severity: Minor
    Found in code/app/Order.php - About 6 hrs to fix

      Method displayColumns has 78 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function displayColumns()
          {
              $ret = [
                  'selection' => (object) [
                      'label' => _i('Selezione'),
      Severity: Major
      Found in code/app/Order.php - About 3 hrs to fix

        Method calculateInvoicingSummary has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function calculateInvoicingSummary()
            {
                $summary = (object) [
                    'order' => $this->id,
                    'total' => 0,
        Severity: Minor
        Found in code/app/Order.php - About 1 hr to fix

          Function unalignedModifiers has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              public function unalignedModifiers($master_summary)
              {
                  if ($this->isActive()) {
                      return [];
                  }
          Severity: Minor
          Found in code/app/Order.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 applyModifiers has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              public function applyModifiers($aggregate_data = null, $enforce_status = false)
              {
                  $modifiers = new Collection();
                  $order_modifiers = $this->involvedModifiers(true);
          
          
          Severity: Minor
          Found in code/app/Order.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 userBooking has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function userBooking($userid = null)
              {
                  $userobj = null;
          
                  if (is_null($userid)) {
          Severity: Minor
          Found in code/app/Order.php - About 1 hr to fix

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

                public function pendingPackages()
                {
                    return $this->innerCache('pending_packages', function($obj) {
                        $ret = new Collection();
                        $products = $obj->products()->where('package_size', '!=', 0)->with('measure')->get();
            Severity: Minor
            Found in code/app/Order.php - About 1 hr to fix

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

                  public function topLevelBookings($status = null)
                  {
                      $ret = [];
              
                      if (is_null($status)) {
              Severity: Minor
              Found in code/app/Order.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 detachProduct has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function detachProduct($product)
                  {
                      $altered_bookings = 0;
              
                      /*
              Severity: Minor
              Found in code/app/Order.php - About 45 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 userBooking has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function userBooking($userid = null)
                  {
                      $userobj = null;
              
                      if (is_null($userid)) {
              Severity: Minor
              Found in code/app/Order.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 getProductConceptsAttribute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getProductConceptsAttribute()
                  {
                      $ret = new Collection();
              
                      foreach ($this->products as $product) {
              Severity: Minor
              Found in code/app/Order.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 calculateInvoicingSummary has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function calculateInvoicingSummary()
                  {
                      $summary = (object) [
                          'order' => $this->id,
                          'total' => 0,
              Severity: Minor
              Found in code/app/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

              There are no issues that match your filters.

              Category
              Status