CORE-POS/IS4C

View on GitHub
fannie/item/PluRangePage.php

Summary

Maintainability
C
1 day
Test Coverage
D
63%

File PluRangePage.php has 282 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

    Copyright 2014 Whole Foods Co-op, Duluth, MN

Severity: Minor
Found in fannie/item/PluRangePage.php - About 2 hrs to fix

    Function findOpenRange has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        private function findOpenRange($dbc, $min, $max) 
        {
            $current = $min;
            $range_start = false;
            $lookup = $dbc->prepare('SELECT upc FROM products WHERE upc=?');
    Severity: Minor
    Found in fannie/item/PluRangePage.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 get_view has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function get_view()
        {
            // Produce ranges as of 19May14
            // 3000 through 4999
            // 93000 through 949999
    Severity: Minor
    Found in fannie/item/PluRangePage.php - About 1 hr to fix

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

          public function post_start_number_handler()
          {
              global $FANNIE_OP_DB;
              $dbc = FannieDB::get($FANNIE_OP_DB); 
      
      
      Severity: Minor
      Found in fannie/item/PluRangePage.php - About 1 hr to fix

        Method get_length_number_view has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function get_length_number_view()
            {
                global $FANNIE_OP_DB;
                $dbc = FannieDB::get($FANNIE_OP_DB);
        
        
        Severity: Minor
        Found in fannie/item/PluRangePage.php - About 1 hr to fix

          Method findReuseBulkPlu has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function findReuseBulkPlu()
              {
                  $dbc = FannieDB::get($this->config->get('OP_DB'));
          
                  $data = array();
          Severity: Minor
          Found in fannie/item/PluRangePage.php - About 1 hr to fix

            Method get_length_number_handler has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function get_length_number_handler()
                {
                    try {
                        $this->validLengthNumber($this->length, $this->number);
                        $min = '1' . str_repeat('0', $this->length-1);
            Severity: Minor
            Found in fannie/item/PluRangePage.php - About 1 hr to fix

              There are no issues that match your filters.

              Category
              Status