CORE-POS/IS4C

View on GitHub
fannie/purchasing/OrderGuidePage.php

Summary

Maintainability
D
2 days
Test Coverage
F
36%

File OrderGuidePage.php has 317 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

include(dirname(__FILE__) . '/../config.php');
if (!class_exists('FannieAPI')) {
    include_once(__DIR__ . '/../classlib2.0/FannieAPI.php');
Severity: Minor
Found in fannie/purchasing/OrderGuidePage.php - About 3 hrs to fix

    Method get_order_view has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function get_order_view()
        {
            list($vendorID, $storeID) = explode(',', $this->order);
            $prep = $this->connection->prepare("
                SELECT o.description, o.upc,
    Severity: Major
    Found in fannie/purchasing/OrderGuidePage.php - About 2 hrs to fix

      Method post_order_handler has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function post_order_handler()
          {
              $vendorID = FormLib::get('vendor');
              $storeID = FormLib::get('store');
              $onhand = FormLib::get('onhand');
      Severity: Minor
      Found in fannie/purchasing/OrderGuidePage.php - About 1 hr to fix

        Method get_new_view has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function get_new_view()
            {
                $stores = FormLib::storePicker();
                $vendor = new VendorsModel($this->connection);
                $vOpts = $vendor->toOptions();
        Severity: Minor
        Found in fannie/purchasing/OrderGuidePage.php - About 1 hr to fix

          Method post_edit_handler has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function post_edit_handler()
              {
                  $vendor = FormLib::get('vendor');
                  $store = FormLib::get('store');
                  $ids = FormLib::get('guide');
          Severity: Minor
          Found in fannie/purchasing/OrderGuidePage.php - About 1 hr to fix

            Method get_edit_view has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function get_edit_view()
                {
                    list($vendorID, $storeID) = explode(',', $this->edit);
                    $prep = $this->connection->prepare("SELECT * FROM OrderGuides WHERE vendorID=? AND storeID=? ORDER BY seq");
                    $guide = $this->connection->getAllRows($prep, array($vendorID, $storeID));
            Severity: Minor
            Found in fannie/purchasing/OrderGuidePage.php - About 1 hr to fix

              Function post_edit_handler has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function post_edit_handler()
                  {
                      $vendor = FormLib::get('vendor');
                      $store = FormLib::get('store');
                      $ids = FormLib::get('guide');
              Severity: Minor
              Found in fannie/purchasing/OrderGuidePage.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 get_view has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function get_view()
                  {
                      $stores = FormLib::storePicker();
                      $storeID = FormLib::get('store');
                      if (!$storeID) {
              Severity: Minor
              Found in fannie/purchasing/OrderGuidePage.php - About 1 hr to fix

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

                    protected function post_order_handler()
                    {
                        $vendorID = FormLib::get('vendor');
                        $storeID = FormLib::get('store');
                        $onhand = FormLib::get('onhand');
                Severity: Minor
                Found in fannie/purchasing/OrderGuidePage.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 post_new_handler has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function post_new_handler()
                    {
                        $model = new OrderGuidesModel($this->connection);
                        $model->vendorID(FormLib::get('vendor'));
                        $model->storeID(FormLib::get('store'));
                Severity: Minor
                Found in fannie/purchasing/OrderGuidePage.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