CORE-POS/IS4C

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

Summary

Maintainability
D
1 day
Test Coverage
F
12%

Method post_handler has 131 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function post_handler()
    {
        $this->saveForm();
        $pdf = new FPDF('P', 'in', array(3.5, 1.25));
        $pdf->SetMargins(0, 0, 0);
Severity: Major
Found in fannie/item/images/NutriFacts.php - About 5 hrs to fix

    File NutriFacts.php has 307 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

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

          protected function get_view()
          {
              $this->addScript('nutrifacts.js');
              $ret = <<<HTML
      <form method="post" target="_blank">
      Severity: Major
      Found in fannie/item/images/NutriFacts.php - About 2 hrs to fix

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

            private function saveForm()
            {
                $req = new NutriFactReqItemsModel($this->connection);
                $req->upc(BarcodeLib::padUPC($this->form->upc));
                $req->servingSize($this->form->serving_size);
        Severity: Minor
        Found in fannie/item/images/NutriFacts.php - About 1 hr to fix

          Function post_handler has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function post_handler()
              {
                  $this->saveForm();
                  $pdf = new FPDF('P', 'in', array(3.5, 1.25));
                  $pdf->SetMargins(0, 0, 0);
          Severity: Minor
          Found in fannie/item/images/NutriFacts.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

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

              private function saveForm()
              {
                  $req = new NutriFactReqItemsModel($this->connection);
                  $req->upc(BarcodeLib::padUPC($this->form->upc));
                  $req->servingSize($this->form->serving_size);
          Severity: Minor
          Found in fannie/item/images/NutriFacts.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

          There are no issues that match your filters.

          Category
          Status