madbob/GASdottoNG

View on GitHub
code/app/Services/BookingsService.php

Summary

Maintainability
D
2 days
Test Coverage

Function readBooking has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

    private function readBooking(array $request, $order, $booking, $delivering)
    {
        $param = $this->handlingParam($delivering);

        if (isset($request['notes_' . $order->id])) {
Severity: Minor
Found in code/app/Services/BookingsService.php - About 5 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

File BookingsService.php has 292 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace App\Services;

use Illuminate\Support\Collection;
Severity: Minor
Found in code/app/Services/BookingsService.php - About 3 hrs to fix

    Function handlePreProcess has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function handlePreProcess($request, $booking)
        {
            $manual_total = $this->deliveringManualTotal($request, $booking->order);
            if ($manual_total > 0) {
                $booking->enforceTotal($manual_total);
    Severity: Minor
    Found in code/app/Services/BookingsService.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 readVariants has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        private function readVariants($product, $booked, $values, $quantities, $delivering)
        {
            $param = $this->handlingParam($delivering);
            $quantity = 0;
            $saved_variants = [];
    Severity: Minor
    Found in code/app/Services/BookingsService.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 readBooking has 59 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function readBooking(array $request, $order, $booking, $delivering)
        {
            $param = $this->handlingParam($delivering);
    
            if (isset($request['notes_' . $order->id])) {
    Severity: Major
    Found in code/app/Services/BookingsService.php - About 2 hrs to fix

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

          private function readVariants($product, $booked, $values, $quantities, $delivering)
          {
              $param = $this->handlingParam($delivering);
              $quantity = 0;
              $saved_variants = [];
      Severity: Minor
      Found in code/app/Services/BookingsService.php - About 1 hr to fix

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

            protected function testAccess($target, $orders, $delivering)
            {
                $user = Auth::user();
                $valid = false;
        
        
        Severity: Minor
        Found in code/app/Services/BookingsService.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 readVariants has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            private function readVariants($product, $booked, $values, $quantities, $delivering)
        Severity: Minor
        Found in code/app/Services/BookingsService.php - About 35 mins to fix

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

              public function handleBookingUpdate($request, $user, $order, $target_user, $delivering)
          Severity: Minor
          Found in code/app/Services/BookingsService.php - About 35 mins to fix

            There are no issues that match your filters.

            Category
            Status