CORE-POS/IS4C

View on GitHub
fannie/classlib2.0/FannieReportPage.php

Summary

Maintainability
F
1 wk
Test Coverage
F
41%

File FannieReportPage.php has 939 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

    Copyright 2012 Whole Foods Co-op

Severity: Major
Found in fannie/classlib2.0/FannieReportPage.php - About 2 days to fix

    Function render_data has a Cognitive Complexity of 114 (exceeds 5 allowed). Consider refactoring.
    Open

        public function render_data($data,$headers=array(),$footers=array(),$format='html')
        {
            $url = $this->config->get('URL');
            $ret = "";
            switch(strtolower($format)) {
    Severity: Minor
    Found in fannie/classlib2.0/FannieReportPage.php - About 2 days 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 render_data has 307 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function render_data($data,$headers=array(),$footers=array(),$format='html')
        {
            $url = $this->config->get('URL');
            $ret = "";
            switch(strtolower($format)) {
    Severity: Major
    Found in fannie/classlib2.0/FannieReportPage.php - About 1 day to fix

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

          public function htmlLine($row, $header=False)
          {
              $url = $this->config->get('URL');
              $meta = 0;
              if (isset($row['meta'])) {
      Severity: Minor
      Found in fannie/classlib2.0/FannieReportPage.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

      Function drawPage has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
      Open

          function drawPage()
          {
              if (!($this->config instanceof FannieConfig)) {
                  $this->config = FannieConfig::factory();
              }
      Severity: Minor
      Found in fannie/classlib2.0/FannieReportPage.php - About 6 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

      FannieReportPage has 36 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class FannieReportPage extends FanniePage 
      {
      
          public $required = True;
      
      
      Severity: Minor
      Found in fannie/classlib2.0/FannieReportPage.php - About 4 hrs to fix

        Method htmlLine has 95 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function htmlLine($row, $header=False)
            {
                $url = $this->config->get('URL');
                $meta = 0;
                if (isset($row['meta'])) {
        Severity: Major
        Found in fannie/classlib2.0/FannieReportPage.php - About 3 hrs to fix

          Function multiContent has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function multiContent($data)
              {
                  $output = '';
                  if ($this->report_format != 'xls') {
                      foreach($data as $report_data) {
          Severity: Minor
          Found in fannie/classlib2.0/FannieReportPage.php - About 3 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 drawPage has 68 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function drawPage()
              {
                  if (!($this->config instanceof FannieConfig)) {
                      $this->config = FannieConfig::factory();
                  }
          Severity: Major
          Found in fannie/classlib2.0/FannieReportPage.php - About 2 hrs to fix

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

                protected function multiContent($data)
                {
                    $output = '';
                    if ($this->report_format != 'xls') {
                        foreach($data as $report_data) {
            Severity: Major
            Found in fannie/classlib2.0/FannieReportPage.php - About 2 hrs to fix

              Method defaultDescriptionContent has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function defaultDescriptionContent($rowcount, $datefields=array())
                  {
                      $ret = array();
                      $ret[] = '<div class="hidden-print">' . $this->header . '</div>';
                      $ret[] = '<div class="hidden-print">' . _('Report generated') . ' ' . date('l, F j, Y g:iA') . '</div>';
              Severity: Minor
              Found in fannie/classlib2.0/FannieReportPage.php - About 1 hr to fix

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

                    protected function getData()
                    {
                        $data = array();
                        $cached = $this->checkDataCache();
                        if ($cached !== false) {
                Severity: Minor
                Found in fannie/classlib2.0/FannieReportPage.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 select_headers has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function select_headers($incrIndex=False) 
                    {
                        $headers = array();
                        $hIndex = $this->header_index;
                        if (is_array($this->report_headers[0])) {
                Severity: Minor
                Found in fannie/classlib2.0/FannieReportPage.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 xlsMeta has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function xlsMeta($data)
                    {
                        $fixup = array();
                        foreach($data as $row) {
                            $meta = 0;
                Severity: Minor
                Found in fannie/classlib2.0/FannieReportPage.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

                Function defaultDescriptionContent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function defaultDescriptionContent($rowcount, $datefields=array())
                    {
                        $ret = array();
                        $ret[] = '<div class="hidden-print">' . $this->header . '</div>';
                        $ret[] = '<div class="hidden-print">' . _('Report generated') . ' ' . date('l, F j, Y g:iA') . '</div>';
                Severity: Minor
                Found in fannie/classlib2.0/FannieReportPage.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

                Avoid too many return statements within this method.
                Open

                        return $ret;
                Severity: Major
                Found in fannie/classlib2.0/FannieReportPage.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                          return $carry;
                  Severity: Major
                  Found in fannie/classlib2.0/FannieReportPage.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                            return $carry;
                    Severity: Major
                    Found in fannie/classlib2.0/FannieReportPage.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                              return $carry;
                      Severity: Major
                      Found in fannie/classlib2.0/FannieReportPage.php - About 30 mins to fix

                        There are no issues that match your filters.

                        Category
                        Status