CORE-POS/IS4C

View on GitHub
fannie/reports/BatchReport/BatchReport.php

Summary

Maintainability
D
1 day
Test Coverage
C
71%

File BatchReport.php has 370 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

    Copyright 2012 Whole Foods Co-op

Severity: Minor
Found in fannie/reports/BatchReport/BatchReport.php - About 4 hrs to fix

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

        function form_content()
        {
            $dbc = $this->connection;
            $dbc->selectDB($this->config->get('OP_DB'));
    
    
    Severity: Major
    Found in fannie/reports/BatchReport/BatchReport.php - About 2 hrs to fix

      Method fetch_report_data has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function fetch_report_data()
          {
              $dbc = $this->connection;
              $dbc->selectDB($this->config->get('OP_DB'));
              $bStart = FormLib::get_form_value('date1','');
      Severity: Major
      Found in fannie/reports/BatchReport/BatchReport.php - About 2 hrs to fix

        Method ajaxItemSales has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function ajaxItemSales()
            {
                $upc = BarcodeLib::padUPC(FormLib::get('upc'));
                $date1 = FormLib::get('date1');
                $date2 = FormLib::get('date2');
        Severity: Major
        Found in fannie/reports/BatchReport/BatchReport.php - About 2 hrs to fix

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

              function report_description_content()
              {
                  $FANNIE_URL = $this->config->get('URL');
                  $dbc = $this->connection;
                  $dbc->selectDB($this->config->get('OP_DB'));
          Severity: Minor
          Found in fannie/reports/BatchReport/BatchReport.php - About 1 hr to fix

            Function ajaxItemSales has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                private function ajaxItemSales()
                {
                    $upc = BarcodeLib::padUPC(FormLib::get('upc'));
                    $date1 = FormLib::get('date1');
                    $date2 = FormLib::get('date2');
            Severity: Minor
            Found in fannie/reports/BatchReport/BatchReport.php - About 55 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 getNameAndDates has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                private function getNameAndDates($batchID, $bStart, $bEnd)
                {
                    $dbc = $this->connection;
                    list($inClause, $inArgs) = $dbc->safeInClause($batchID);
                    $batchInfoQ = $dbc->prepare("
            Severity: Minor
            Found in fannie/reports/BatchReport/BatchReport.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