CORE-POS/IS4C

View on GitHub
fannie/batches/newbatch/BatchListPage.php

Summary

Maintainability
F
4 days
Test Coverage
B
85%

File BatchListPage.php has 525 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

    Copyright 2009,2010 Whole Foods Co-op

Severity: Major
Found in fannie/batches/newbatch/BatchListPage.php - About 1 day to fix

    Method batchListDisplay has 122 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function batchListDisplay($filter='', $mode='', $maxBatchID='')
        {
            global $FANNIE_URL;
            $dbc = $this->con;
    
    
    Severity: Major
    Found in fannie/batches/newbatch/BatchListPage.php - About 4 hrs to fix

      Function batchListDisplay has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          function batchListDisplay($filter='', $mode='', $maxBatchID='')
          {
              global $FANNIE_URL;
              $dbc = $this->con;
      
      
      Severity: Minor
      Found in fannie/batches/newbatch/BatchListPage.php - About 4 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 newBatchInput has 86 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function newBatchInput()
          {
              $dbc = FannieDB::get($this->config->get('OP_DB'));
              $url = $this->config->get('URL');
      
      
      Severity: Major
      Found in fannie/batches/newbatch/BatchListPage.php - About 3 hrs to fix

        Method unitTest has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function unitTest($phpunit)
            {
                $get = $this->get_view();
                $phpunit->assertNotEquals(0, strlen($get));
        
        
        Severity: Major
        Found in fannie/batches/newbatch/BatchListPage.php - About 2 hrs to fix

          Method post_id_batchName_batchType_startDate_endDate_owner_handler has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function post_id_batchName_batchType_startDate_endDate_owner_handler()
              {
                  global $FANNIE_OP_DB;
                  $dbc = FannieDB::get($FANNIE_OP_DB);
          
          
          Severity: Major
          Found in fannie/batches/newbatch/BatchListPage.php - About 2 hrs to fix

            Method post_newType_newName_newStart_newEnd_newOwner_handler has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function post_newType_newName_newStart_newEnd_newOwner_handler()
                {
                    global $FANNIE_OP_DB;
                    $dbc = FannieDB::get($FANNIE_OP_DB);
                    $json = array('error'=>0, 'msg'=>'Created batch ' . $this->newName);
            Severity: Minor
            Found in fannie/batches/newbatch/BatchListPage.php - About 1 hr to fix

              Function post_id_batchName_batchType_startDate_endDate_owner_handler has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function post_id_batchName_batchType_startDate_endDate_owner_handler()
                  {
                      global $FANNIE_OP_DB;
                      $dbc = FannieDB::get($FANNIE_OP_DB);
              
              
              Severity: Minor
              Found in fannie/batches/newbatch/BatchListPage.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 post_delete_id_handler has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function post_delete_id_handler()
                  {
                      global $FANNIE_OP_DB;
                      $json = array('error'=>0,'msg'=>'Deleted batch #' . $this->id);
                      $dbc = FannieDB::get($FANNIE_OP_DB);
              Severity: Minor
              Found in fannie/batches/newbatch/BatchListPage.php - About 1 hr to fix

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

                    private function batchToTableRow($batch)
                    {
                        /**
                          strtotime() and date() are not reciprocal functions
                          date('Y-m-d', strtotime('0000-00-00')) results in
                Severity: Minor
                Found in fannie/batches/newbatch/BatchListPage.php - About 1 hr to fix

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

                      protected function post_newType_newName_newStart_newEnd_newOwner_handler()
                      {
                          global $FANNIE_OP_DB;
                          $dbc = FannieDB::get($FANNIE_OP_DB);
                          $json = array('error'=>0, 'msg'=>'Created batch ' . $this->newName);
                  Severity: Minor
                  Found in fannie/batches/newbatch/BatchListPage.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