CORE-POS/IS4C

View on GitHub
fannie/modules/plugins2.0/Pickup/ViewPickups.php

Summary

Maintainability
D
2 days
Test Coverage

File ViewPickups.php has 408 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

use COREPOS\Fannie\API\lib\Store;

include(__DIR__ . '/../../../config.php');
Severity: Minor
Found in fannie/modules/plugins2.0/Pickup/ViewPickups.php - About 5 hrs to fix

    Method get_view has 110 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function get_view()
        {
            $store = FormLib::get('store', false);
            if ($store === false) {
                $store = Store::getIdByIp();
    Severity: Major
    Found in fannie/modules/plugins2.0/Pickup/ViewPickups.php - About 4 hrs to fix

      Method get_id_view has 100 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function get_id_view()
          {
              $order = new PickupOrdersModel($this->connection);
              $order->pickupOrderID($this->id);
              $order->load();
      Severity: Major
      Found in fannie/modules/plugins2.0/Pickup/ViewPickups.php - About 4 hrs to fix

        Method post_id_print_handler has 75 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function post_id_print_handler()
            {
        
                $pdf=new FPDF('P','mm','Letter'); //start new instance of PDF
                $pdf->Open(); //open new PDF Document
        Severity: Major
        Found in fannie/modules/plugins2.0/Pickup/ViewPickups.php - About 3 hrs to fix

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

              protected function post_id_print_handler()
              {
          
                  $pdf=new FPDF('P','mm','Letter'); //start new instance of PDF
                  $pdf->Open(); //open new PDF Document
          Severity: Minor
          Found in fannie/modules/plugins2.0/Pickup/ViewPickups.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 pickList has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function pickList($orderID, $store)
              {
                  $prep = $this->connection->prepare("
                      SELECT p.upc, p.brand, p.description, p.quantity, q.size, q.scale
                      FROM PickupOrderItems AS p
          Severity: Minor
          Found in fannie/modules/plugins2.0/Pickup/ViewPickups.php - About 1 hr to fix

            Function get_view has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function get_view()
                {
                    $store = FormLib::get('store', false);
                    if ($store === false) {
                        $store = Store::getIdByIp();
            Severity: Minor
            Found in fannie/modules/plugins2.0/Pickup/ViewPickups.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

            Avoid too many return statements within this method.
            Open

                    return $list;
            Severity: Major
            Found in fannie/modules/plugins2.0/Pickup/ViewPickups.php - About 30 mins to fix

              Function pickList has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function pickList($orderID, $store)
                  {
                      $prep = $this->connection->prepare("
                          SELECT p.upc, p.brand, p.description, p.quantity, q.size, q.scale
                          FROM PickupOrderItems AS p
              Severity: Minor
              Found in fannie/modules/plugins2.0/Pickup/ViewPickups.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