CORE-POS/IS4C

View on GitHub
fannie/item/vendors/VendorIndexPage.php

Summary

Maintainability
F
4 days
Test Coverage
D
69%

File VendorIndexPage.php has 643 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/*******************************************************************************

    Copyright 2009,2013 Whole Foods Co-op

Severity: Major
Found in fannie/item/vendors/VendorIndexPage.php - About 1 day to fix

    Method getVendorInfo has 278 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function getVendorInfo($id)
        {
            $dbc = FannieDB::get($this->config->get('OP_DB'));
            $ret = "";
            $noEdit = !$this->canEdit ? 'disabled' : '';
    Severity: Major
    Found in fannie/item/vendors/VendorIndexPage.php - About 1 day to fix

      Function getVendorInfo has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          private function getVendorInfo($id)
          {
              $dbc = FannieDB::get($this->config->get('OP_DB'));
              $ret = "";
              $noEdit = !$this->canEdit ? 'disabled' : '';
      Severity: Minor
      Found in fannie/item/vendors/VendorIndexPage.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 helpContent has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function helpContent()
          {
              return '<p>Vendors are the entities the store purchases its 
                  products from. The most important data associated with
                  a vendor is their catalog of items. A product that the store
      Severity: Major
      Found in fannie/item/vendors/VendorIndexPage.php - About 2 hrs to fix

        Method autoPopulate has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function autoPopulate($vendorID)
            {
                if (!$this->canEdit) return false;
                $dbc = FannieDB::get($this->config->get('OP_DB'));
                
        Severity: Minor
        Found in fannie/item/vendors/VendorIndexPage.php - About 1 hr to fix

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

              protected function get_view()
              {
                  $dbc = FannieDB::get($this->config->get('OP_DB'));
                  $vendors = "<option value=\"\">Select a vendor...</option>";
                  $vendors .= "<option value=\"new\">New vendor...</option>";
          Severity: Minor
          Found in fannie/item/vendors/VendorIndexPage.php - About 1 hr to fix

            Method post_info_handler has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function post_info_handler()
                {
                    if (!$this->canEdit) return false;
                    $id = FormLib::get('vendorID','');
                    if ($id === '') {
            Severity: Minor
            Found in fannie/item/vendors/VendorIndexPage.php - About 1 hr to fix

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

                  protected function get_view()
                  {
                      $dbc = FannieDB::get($this->config->get('OP_DB'));
                      $vendors = "<option value=\"\">Select a vendor...</option>";
                      $vendors .= "<option value=\"new\">New vendor...</option>";
              Severity: Minor
              Found in fannie/item/vendors/VendorIndexPage.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

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

                  protected function post_info_handler()
                  {
                      if (!$this->canEdit) return false;
                      $id = FormLib::get('vendorID','');
                      if ($id === '') {
              Severity: Minor
              Found in fannie/item/vendors/VendorIndexPage.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