modxcms/revolution

View on GitHub
manager/min/lib/FirePHP.php

Summary

Maintainability
F
2 wks
Test Coverage

Function fb has a Cognitive Complexity of 129 (exceeds 5 allowed). Consider refactoring.
Open

  public function fb($Object) {
  
    if(!$this->enabled) {
      return false;
    }
Severity: Minor
Found in manager/min/lib/FirePHP.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

Function encodeObject has a Cognitive Complexity of 77 (exceeds 5 allowed). Consider refactoring.
Open

  protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1)
  {
    $return = array();
    
    if (is_object($Object)) {
Severity: Minor
Found in manager/min/lib/FirePHP.php - About 1 day 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

File FirePHP.php has 656 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * *** BEGIN LICENSE BLOCK *****
 *  
 * This file is part of FirePHP (http://www.firephp.org/).
Severity: Major
Found in manager/min/lib/FirePHP.php - About 1 day to fix

    Method fb has 199 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public function fb($Object) {
      
        if(!$this->enabled) {
          return false;
        }
    Severity: Major
    Found in manager/min/lib/FirePHP.php - About 7 hrs to fix

      Method json_encode has 130 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private function json_encode($var)
        {
          
          if(is_object($var)) {
            if(in_array($var,$this->json_objectStack)) {
      Severity: Major
      Found in manager/min/lib/FirePHP.php - About 5 hrs to fix

        FirePHP has 38 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class FirePHP {
          
          /**
           * FirePHP version
           *
        Severity: Minor
        Found in manager/min/lib/FirePHP.php - About 5 hrs to fix

          Function json_encode has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
          Open

            private function json_encode($var)
            {
              
              if(is_object($var)) {
                if(in_array($var,$this->json_objectStack)) {
          Severity: Minor
          Found in manager/min/lib/FirePHP.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 encodeObject has 93 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1)
            {
              $return = array();
              
              if (is_object($Object)) {
          Severity: Major
          Found in manager/min/lib/FirePHP.php - About 3 hrs to fix

            Function is_utf8 has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

              protected static function is_utf8($str) {
                $c=0; $b=0;
                $bits=0;
                $len=strlen($str);
                for($i=0; $i<$len; $i++){
            Severity: Minor
            Found in manager/min/lib/FirePHP.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

            Consider simplifying this complex logical expression.
            Open

                      if(isset($trace[$i]['class'])
                         && isset($trace[$i]['file'])
                         && ($trace[$i]['class']=='FirePHP'
                             || $trace[$i]['class']=='FB')
                         && (substr($this->_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php'
            Severity: Major
            Found in manager/min/lib/FirePHP.php - About 40 mins to fix

              Consider simplifying this complex logical expression.
              Open

                      if(isset($trace[$i]['class'])
                         && isset($trace[$i]['file'])
                         && ($trace[$i]['class']=='FirePHP'
                             || $trace[$i]['class']=='FB')
                         && (substr($this->_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php'
              Severity: Major
              Found in manager/min/lib/FirePHP.php - About 40 mins to fix

                Method errorHandler has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  public function errorHandler($errno, $errstr, $errfile, $errline, $errcontext)
                Severity: Minor
                Found in manager/min/lib/FirePHP.php - About 35 mins to fix

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

                    protected function encodeTable($Table) {
                      if(!$Table) return $Table;
                      for( $i=0 ; $i<count($Table) ; $i++ ) {
                        if(is_array($Table[$i])) {
                          for( $j=0 ; $j<count($Table[$i]) ; $j++ ) {
                  Severity: Minor
                  Found in manager/min/lib/FirePHP.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 null;
                  Severity: Major
                  Found in manager/min/lib/FirePHP.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                          return $property;
                    Severity: Major
                    Found in manager/min/lib/FirePHP.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                          return $return;
                      Severity: Major
                      Found in manager/min/lib/FirePHP.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                            return true;
                        Severity: Major
                        Found in manager/min/lib/FirePHP.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                        return '"'.$ascii.'"';
                          Severity: Major
                          Found in manager/min/lib/FirePHP.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                          return '[' . join(',', $elements) . ']';
                            Severity: Major
                            Found in manager/min/lib/FirePHP.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                    return '';
                              Severity: Major
                              Found in manager/min/lib/FirePHP.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                        return utf8_encode($Object);
                                Severity: Major
                                Found in manager/min/lib/FirePHP.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                                return (float) $var;
                                  Severity: Major
                                  Found in manager/min/lib/FirePHP.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                                  return '{' . join(',', $properties) . '}';
                                    Severity: Major
                                    Found in manager/min/lib/FirePHP.php - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                                                return $property;
                                      Severity: Major
                                      Found in manager/min/lib/FirePHP.php - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                          return '{' . join(',', $properties) . '}';
                                        Severity: Major
                                        Found in manager/min/lib/FirePHP.php - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                                return $element;
                                          Severity: Major
                                          Found in manager/min/lib/FirePHP.php - About 30 mins to fix

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

                                              protected function _escapeTrace($Trace) {
                                                if(!$Trace) return $Trace;
                                                for( $i=0 ; $i<sizeof($Trace) ; $i++ ) {
                                                  if(isset($Trace[$i]['file'])) {
                                                    $Trace[$i]['file'] = $this->_escapeTraceFile($Trace[$i]['file']);
                                            Severity: Minor
                                            Found in manager/min/lib/FirePHP.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

                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                            Open

                                                      case 'string':
                                                          // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
                                                          $ascii = '';
                                                          $strlen_var = strlen($var);
                                            
                                            
                                            Severity: Major
                                            Found in manager/min/lib/FirePHP.php and 1 other location - About 4 days to fix
                                            core/xpdo/json/JSON.php on lines 255..358

                                            Duplicated Code

                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                            Tuning

                                            This issue has a mass of 867.

                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                            Refactorings

                                            Further Reading

                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                            Open

                                              private function json_utf82utf16($utf8)
                                              {
                                                  // oh please oh please oh please oh please oh please
                                                  if(function_exists('mb_convert_encoding')) {
                                                      return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
                                            Severity: Major
                                            Found in manager/min/lib/FirePHP.php and 1 other location - About 7 hrs to fix
                                            core/xpdo/json/JSON.php on lines 195..226

                                            Duplicated Code

                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                            Tuning

                                            This issue has a mass of 244.

                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                            Refactorings

                                            Further Reading

                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                            Open

                                                    if(isset($trace[$i]['class'])
                                                       && isset($trace[$i]['file'])
                                                       && ($trace[$i]['class']=='FirePHP'
                                                           || $trace[$i]['class']=='FB')
                                                       && (substr($this->_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php'
                                            Severity: Major
                                            Found in manager/min/lib/FirePHP.php and 1 other location - About 2 hrs to fix
                                            manager/min/lib/FirePHP.php on lines 644..665

                                            Duplicated Code

                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                            Tuning

                                            This issue has a mass of 132.

                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                            Refactorings

                                            Further Reading

                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                            Open

                                                      if(isset($trace[$i]['class'])
                                                         && isset($trace[$i]['file'])
                                                         && ($trace[$i]['class']=='FirePHP'
                                                             || $trace[$i]['class']=='FB')
                                                         && (substr($this->_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php'
                                            Severity: Major
                                            Found in manager/min/lib/FirePHP.php and 1 other location - About 2 hrs to fix
                                            manager/min/lib/FirePHP.php on lines 588..618

                                            Duplicated Code

                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                            Tuning

                                            This issue has a mass of 132.

                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                            Refactorings

                                            Further Reading

                                            There are no issues that match your filters.

                                            Category
                                            Status