CORE-POS/IS4C

View on GitHub
fannie/item/images/NutriFactEntry.php

Summary

Maintainability
D
2 days
Test Coverage

Method javascriptContent has 159 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function javascriptContent()
    {
        $dbc = $this->connection;
        $json = array();
        $prep = $dbc->prepare("SELECT * FROM NutriFactStd");
Severity: Major
Found in fannie/item/images/NutriFactEntry.php - About 6 hrs to fix

    File NutriFactEntry.php has 418 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /*******************************************************************************
    
        Copyright 2013 Whole Foods Community Co-op
    
    
    Severity: Minor
    Found in fannie/item/images/NutriFactEntry.php - About 6 hrs to fix

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

          public function get_view()
          {
              $dbc = $this->connection;
      
              //$nutriCols = array("servingSize","calories","fatCalories","totalFat","saturatedFat","transFat","cholesterol","sodium","totalCarbs","fiber","sugar","addedSugar","protein");
      Severity: Major
      Found in fannie/item/images/NutriFactEntry.php - About 2 hrs to fix

        Method post_nutrient_handler has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function post_nutrient_handler()
            {
                $dbc = $this->connection;
                $mode = FormLib::get('nutrient');
                $upc = FormLib::get('upc');
        Severity: Minor
        Found in fannie/item/images/NutriFactEntry.php - About 1 hr to fix

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

              public function post_nutriFacts_handler()
              {
                  $upc = FormLib::get('upc');
                  $upc = BarcodeLib::padUPC($upc);
                  $dbc = $this->connection;
          Severity: Minor
          Found in fannie/item/images/NutriFactEntry.php - About 1 hr to fix

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

                public function post_id_handler()
                {
                    $col = FormLib::get('col');
                    $upc = FormLib::get('upc');
                    $val = FormLib::get('val');
            Severity: Minor
            Found in fannie/item/images/NutriFactEntry.php - About 1 hr to fix

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

                  public function post_nutrient_handler()
                  {
                      $dbc = $this->connection;
                      $mode = FormLib::get('nutrient');
                      $upc = FormLib::get('upc');
              Severity: Minor
              Found in fannie/item/images/NutriFactEntry.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