CORE-POS/IS4C

View on GitHub
fannie/item/ProductListPage.php

Summary

Maintainability
F
4 days
Test Coverage
F
18%

File ProductListPage.php has 575 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

    Copyright 2013 Whole Foods Co-op

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

    Function list_content has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
    Open

        private function list_content()
        {
            global $FANNIE_OP_DB;
            $dbc = FannieDB::get($FANNIE_OP_DB);
    
    
    Severity: Minor
    Found in fannie/item/ProductListPage.php - About 7 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 list_content has 174 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function list_content()
        {
            global $FANNIE_OP_DB;
            $dbc = FannieDB::get($FANNIE_OP_DB);
    
    
    Severity: Major
    Found in fannie/item/ProductListPage.php - About 6 hrs to fix

      Method form_content has 82 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function form_content()
          {
              global $FANNIE_OP_DB;
              $dbc = FannieDB::get($FANNIE_OP_DB);
      
      
      Severity: Major
      Found in fannie/item/ProductListPage.php - About 3 hrs to fix

        Method javascript_content has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function javascript_content()
            {
                global $FANNIE_OP_DB;
        
                if ($this->excel) return '';
        Severity: Minor
        Found in fannie/item/ProductListPage.php - About 1 hr to fix

          Method rowToTable has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function rowToTable($row, $multi)
              {
                  $ret = '<tr id="'.$row[0].'">';
                  $enc = base64_encode($row[1]);
                  if (!$this->excel) {
          Severity: Minor
          Found in fannie/item/ProductListPage.php - About 1 hr to fix

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

                function javascript_content()
                {
                    global $FANNIE_OP_DB;
            
                    if ($this->excel) return '';
            Severity: Minor
            Found in fannie/item/ProductListPage.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 ajax_response has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function ajax_response()
                {
                    global $FANNIE_OP_DB;
                    $dbc = FannieDB::get($FANNIE_OP_DB);
                    switch(FormLib::get('ajax')){
            Severity: Minor
            Found in fannie/item/ProductListPage.php - About 1 hr to fix

              Method saveItem has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function saveItem($dbc, $upc, $store_id, $form)
                  {
                      $model = new ProductsModel($dbc);
                      $model->upc($upc);
                      $model->store_id($store_id);
              Severity: Minor
              Found in fannie/item/ProductListPage.php - About 1 hr to fix

                Function rowToTable has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function rowToTable($row, $multi)
                    {
                        $ret = '<tr id="'.$row[0].'">';
                        $enc = base64_encode($row[1]);
                        if (!$this->excel) {
                Severity: Minor
                Found in fannie/item/ProductListPage.php - About 45 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 saveItem has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function saveItem($dbc, $upc, $store_id, $form)
                    {
                        $model = new ProductsModel($dbc);
                        $model->upc($upc);
                        $model->store_id($store_id);
                Severity: Minor
                Found in fannie/item/ProductListPage.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

                There are no issues that match your filters.

                Category
                Status