madbob/GASdottoNG

View on GitHub
code/app/BookedProduct.php

Summary

Maintainability
B
6 hrs
Test Coverage

File BookedProduct.php has 275 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace App;

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

    BookedProduct has 23 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class BookedProduct extends Model
    {
        use HasFactory, GASModel, SluggableID, TracksUpdater, ModifiedTrait, LeafReducibleTrait, Cachable;
    
        public $incrementing = false;
    Severity: Minor
    Found in code/app/BookedProduct.php - About 2 hrs to fix

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

          public function testConstraints($quantity, $variant = null, $only_mandatory = false)
          {
              $sorted_contraints = Constraint::sortedContraints($only_mandatory);
              foreach($sorted_contraints as $constraints) {
                  foreach($constraints as $constraint) {
      Severity: Minor
      Found in code/app/BookedProduct.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 getValue has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getValue($type)
          {
              $ret = 0;
      
              if (Str::startsWith($type, 'modifier:')) {
      Severity: Minor
      Found in code/app/BookedProduct.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

      There are no issues that match your filters.

      Category
      Status