mambax7/songlist

View on GitHub
class/JSON.php

Summary

Maintainability
F
6 days
Test Coverage

Function decode has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
Open

    public function decode($str)
    {
        $str = $this->reduce_string($str);

        switch (mb_strtolower($str)) {
Severity: Minor
Found in class/JSON.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

Method decode has 174 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function decode($str)
    {
        $str = $this->reduce_string($str);

        switch (mb_strtolower($str)) {
Severity: Major
Found in class/JSON.php - About 6 hrs to fix

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

        public function _encode($var)
        {
            switch (gettype($var)) {
                case 'boolean':
                    return $var ? 'true' : 'false';
    Severity: Minor
    Found in class/JSON.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

    File JSON.php has 421 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php declare(strict_types=1);
    
    /*
    Module: Document
    
    
    Severity: Minor
    Found in class/JSON.php - About 6 hrs to fix

      Method _encode has 126 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function _encode($var)
          {
              switch (gettype($var)) {
                  case 'boolean':
                      return $var ? 'true' : 'false';
      Severity: Major
      Found in class/JSON.php - About 5 hrs to fix

        The class ServicesJSON has an overall complexity of 129 which is very high. The configured complexity threshold is 50.
        Open

        class ServicesJSON
        {
            /**
             * constructs a new JSON instance
             *
        Severity: Minor
        Found in class/JSON.php by phpmd

        Consider simplifying this complex logical expression.
        Open

                                if (($c == $strlen_chrs) || ((',' === $chrs[$c]) && (SERVICES_JSON_SLICE == $top['what']))) {
                                    // found a comma that is not inside a string, array, etc.,
                                    // OR we've reached the end of the character list
                                    $slice = mb_substr($chrs, $top['where'], $c - $top['where']);
                                    array_push($stk, ['what' => SERVICES_JSON_SLICE, 'where' => $c + 1, 'delim' => false]);
        Severity: Critical
        Found in class/JSON.php - About 3 hrs to fix

          Avoid deeply nested control flow statements.
          Open

                                          if (('"' === $delim && '\\\'' !== $substr_chrs_c_2)
                                              || ("'" === $delim && '\\"' !== $substr_chrs_c_2)) {
                                              $utf8 .= $chrs[++$c];
                                          }
          Severity: Major
          Found in class/JSON.php - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                        if (SERVICES_JSON_IN_ARR == reset($stk)) {
                                            // we are in an array, so just push an element onto the stack
                                            $arr[] = $this->decode($slice);
                                        } elseif (SERVICES_JSON_IN_OBJ == reset($stk)) {
                                            // we are in an object, so figure
            Severity: Major
            Found in class/JSON.php - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                          for ($i = $top['where']; $i <= $c; ++$i) {
                                              $chrs = substr_replace($chrs, ' ', $i, 1);
                                          }
              Severity: Major
              Found in class/JSON.php - About 45 mins to fix

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

                            $message = 'unknown error',
                            $code = null,
                            $mode = null,
                            $options = null,
                            $userinfo = null
                Severity: Minor
                Found in class/JSON.php - About 35 mins to fix

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

                              $message = 'unknown error',
                              $code = null,
                              $mode = null,
                              $options = null,
                              $userinfo = null
                  Severity: Minor
                  Found in class/JSON.php - About 35 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                            return $obj;
                    Severity: Major
                    Found in class/JSON.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                              return '';
                      Severity: Major
                      Found in class/JSON.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                return '';
                        Severity: Major
                        Found in class/JSON.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                                      return $arr;
                          Severity: Major
                          Found in class/JSON.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                                    return $obj;
                            Severity: Major
                            Found in class/JSON.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                              return '[' . implode(',', $elements) . ']';
                              Severity: Major
                              Found in class/JSON.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                                            return $property;
                                Severity: Major
                                Found in class/JSON.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                                          return $arr;
                                  Severity: Major
                                  Found in class/JSON.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                                        return '{' . implode(',', $properties) . '}';
                                    Severity: Major
                                    Found in class/JSON.php - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                                      return '{' . implode(',', $properties) . '}';
                                      Severity: Major
                                      Found in class/JSON.php - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                                return $property;
                                        Severity: Major
                                        Found in class/JSON.php - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                          return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS) ? 'null' : new ServicesJSON_Error(gettype($var) . ' can not be encoded as JSON string');
                                          Severity: Major
                                          Found in class/JSON.php - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                                return $utf8;
                                            Severity: Major
                                            Found in class/JSON.php - About 30 mins to fix

                                              Avoid too many return statements within this method.
                                              Open

                                                              return '"' . $ascii . '"';
                                              Severity: Major
                                              Found in class/JSON.php - About 30 mins to fix

                                                Avoid too many return statements within this method.
                                                Open

                                                                        return $element;
                                                Severity: Major
                                                Found in class/JSON.php - About 30 mins to fix

                                                  The method _encode() has 178 lines of code. Current threshold is set to 100. Avoid really long methods.
                                                  Open

                                                      public function _encode($var)
                                                      {
                                                          switch (gettype($var)) {
                                                              case 'boolean':
                                                                  return $var ? 'true' : 'false';
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  The method decode() has 250 lines of code. Current threshold is set to 100. Avoid really long methods.
                                                  Open

                                                      public function decode($str)
                                                      {
                                                          $str = $this->reduce_string($str);
                                                  
                                                          switch (mb_strtolower($str)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  The method decode() has an NPath complexity of 74661. The configured NPath complexity threshold is 200.
                                                  Open

                                                      public function decode($str)
                                                      {
                                                          $str = $this->reduce_string($str);
                                                  
                                                          switch (mb_strtolower($str)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  NPathComplexity

                                                  Since: 0.1

                                                  The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                                                  Example

                                                  class Foo {
                                                      function bar() {
                                                          // lots of complicated code
                                                      }
                                                  }

                                                  Source https://phpmd.org/rules/codesize.html#npathcomplexity

                                                  The method decode() has a Cyclomatic Complexity of 67. The configured cyclomatic complexity threshold is 10.
                                                  Open

                                                      public function decode($str)
                                                      {
                                                          $str = $this->reduce_string($str);
                                                  
                                                          switch (mb_strtolower($str)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CyclomaticComplexity

                                                  Since: 0.1

                                                  Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                  Example

                                                  // Cyclomatic Complexity = 11
                                                  class Foo {
                                                  1   public function example() {
                                                  2       if ($a == $b) {
                                                  3           if ($a1 == $b1) {
                                                                  fiddle();
                                                  4           } elseif ($a2 == $b2) {
                                                                  fiddle();
                                                              } else {
                                                                  fiddle();
                                                              }
                                                  5       } elseif ($c == $d) {
                                                  6           while ($c == $d) {
                                                                  fiddle();
                                                              }
                                                  7        } elseif ($e == $f) {
                                                  8           for ($n = 0; $n < $h; $n++) {
                                                                  fiddle();
                                                              }
                                                          } else {
                                                              switch ($z) {
                                                  9               case 1:
                                                                      fiddle();
                                                                      break;
                                                  10              case 2:
                                                                      fiddle();
                                                                      break;
                                                  11              case 3:
                                                                      fiddle();
                                                                      break;
                                                                  default:
                                                                      fiddle();
                                                                      break;
                                                              }
                                                          }
                                                      }
                                                  }

                                                  Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                  The method _encode() has a Cyclomatic Complexity of 41. The configured cyclomatic complexity threshold is 10.
                                                  Open

                                                      public function _encode($var)
                                                      {
                                                          switch (gettype($var)) {
                                                              case 'boolean':
                                                                  return $var ? 'true' : 'false';
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CyclomaticComplexity

                                                  Since: 0.1

                                                  Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                  Example

                                                  // Cyclomatic Complexity = 11
                                                  class Foo {
                                                  1   public function example() {
                                                  2       if ($a == $b) {
                                                  3           if ($a1 == $b1) {
                                                                  fiddle();
                                                  4           } elseif ($a2 == $b2) {
                                                                  fiddle();
                                                              } else {
                                                                  fiddle();
                                                              }
                                                  5       } elseif ($c == $d) {
                                                  6           while ($c == $d) {
                                                                  fiddle();
                                                              }
                                                  7        } elseif ($e == $f) {
                                                  8           for ($n = 0; $n < $h; $n++) {
                                                                  fiddle();
                                                              }
                                                          } else {
                                                              switch ($z) {
                                                  9               case 1:
                                                                      fiddle();
                                                                      break;
                                                  10              case 2:
                                                                      fiddle();
                                                                      break;
                                                  11              case 3:
                                                                      fiddle();
                                                                      break;
                                                                  default:
                                                                      fiddle();
                                                                      break;
                                                              }
                                                          }
                                                      }
                                                  }

                                                  Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                  Remove error control operator '@' on line 294.
                                                  Open

                                                      public function _encode($var)
                                                      {
                                                          switch (gettype($var)) {
                                                              case 'boolean':
                                                                  return $var ? 'true' : 'false';
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  ErrorControlOperator

                                                  Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

                                                  Example

                                                  function foo($filePath) {
                                                      $file = @fopen($filPath); // hides exceptions
                                                      $key = @$array[$notExistingKey]; // assigns null to $key
                                                  }

                                                  Source http://phpmd.org/rules/cleancode.html#errorcontroloperator

                                                  Remove error control operator '@' on line 294.
                                                  Open

                                                      public function _encode($var)
                                                      {
                                                          switch (gettype($var)) {
                                                              case 'boolean':
                                                                  return $var ? 'true' : 'false';
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  ErrorControlOperator

                                                  Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

                                                  Example

                                                  function foo($filePath) {
                                                      $file = @fopen($filPath); // hides exceptions
                                                      $key = @$array[$notExistingKey]; // assigns null to $key
                                                  }

                                                  Source http://phpmd.org/rules/cleancode.html#errorcontroloperator

                                                  Missing class import via use statement (line '581', column '40').
                                                  Open

                                                                              $obj = new stdClass();
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  MissingImport

                                                  Since: 2.7.0

                                                  Importing all external classes in a file through use statements makes them clearly visible.

                                                  Example

                                                  function make() {
                                                      return new \stdClass();
                                                  }

                                                  Source http://phpmd.org/rules/cleancode.html#MissingImport

                                                  Missing class import via use statement (line '397', column '84').
                                                  Open

                                                                  return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS) ? 'null' : new ServicesJSON_Error(gettype($var) . ' can not be encoded as JSON string');
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  MissingImport

                                                  Since: 2.7.0

                                                  Importing all external classes in a file through use statements makes them clearly visible.

                                                  Example

                                                  function make() {
                                                      return new \stdClass();
                                                  }

                                                  Source http://phpmd.org/rules/cleancode.html#MissingImport

                                                  The method decode uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                  Open

                                                                          } else {
                                                                              $stk = [SERVICES_JSON_IN_OBJ];
                                                                              $obj = new stdClass();
                                                                      }
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  ElseExpression

                                                  Since: 1.4.0

                                                  An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                  Example

                                                  class Foo
                                                  {
                                                      public function bar($flag)
                                                      {
                                                          if ($flag) {
                                                              // one branch
                                                          } else {
                                                              // another branch
                                                          }
                                                      }
                                                  }

                                                  Source https://phpmd.org/rules/cleancode.html#elseexpression

                                                  Avoid using static access to class 'PEAR' in method 'isError'.
                                                  Open

                                                              return PEAR::isError($data, $code);
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  StaticAccess

                                                  Since: 1.4.0

                                                  Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                                                  Example

                                                  class Foo
                                                  {
                                                      public function bar()
                                                      {
                                                          Bar::baz();
                                                      }
                                                  }

                                                  Source https://phpmd.org/rules/cleancode.html#staticaccess

                                                  The method decode uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                  Open

                                                                                      } else {
                                                                                          $obj->$key = $val;
                                                                                      }
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  ElseExpression

                                                  Since: 1.4.0

                                                  An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                  Example

                                                  class Foo
                                                  {
                                                      public function bar($flag)
                                                      {
                                                          if ($flag) {
                                                              // one branch
                                                          } else {
                                                              // another branch
                                                          }
                                                      }
                                                  }

                                                  Source https://phpmd.org/rules/cleancode.html#elseexpression

                                                  The method decode uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                  Open

                                                                                      } else {
                                                                                          $obj->$key = $val;
                                                                                      }
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  ElseExpression

                                                  Since: 1.4.0

                                                  An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                  Example

                                                  class Foo
                                                  {
                                                      public function bar($flag)
                                                      {
                                                          if ($flag) {
                                                              // one branch
                                                          } else {
                                                              // another branch
                                                          }
                                                      }
                                                  }

                                                  Source https://phpmd.org/rules/cleancode.html#elseexpression

                                                  Avoid unused parameters such as '$message'.
                                                  Open

                                                              $message = 'unknown error',
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  UnusedFormalParameter

                                                  Since: 0.2

                                                  Avoid passing parameters to methods or constructors and then not using those parameters.

                                                  Example

                                                  class Foo
                                                  {
                                                      private function bar($howdy)
                                                      {
                                                          // $howdy is not used
                                                      }
                                                  }

                                                  Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

                                                  Avoid unused parameters such as '$mode'.
                                                  Open

                                                              $mode = null,
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  UnusedFormalParameter

                                                  Since: 0.2

                                                  Avoid passing parameters to methods or constructors and then not using those parameters.

                                                  Example

                                                  class Foo
                                                  {
                                                      private function bar($howdy)
                                                      {
                                                          // $howdy is not used
                                                      }
                                                  }

                                                  Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

                                                  Avoid unused parameters such as '$options'.
                                                  Open

                                                              $options = null,
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  UnusedFormalParameter

                                                  Since: 0.2

                                                  Avoid passing parameters to methods or constructors and then not using those parameters.

                                                  Example

                                                  class Foo
                                                  {
                                                      private function bar($howdy)
                                                      {
                                                          // $howdy is not used
                                                      }
                                                  }

                                                  Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

                                                  Avoid unused parameters such as '$userinfo'.
                                                  Open

                                                              $userinfo = null
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  UnusedFormalParameter

                                                  Since: 0.2

                                                  Avoid passing parameters to methods or constructors and then not using those parameters.

                                                  Example

                                                  class Foo
                                                  {
                                                      private function bar($howdy)
                                                      {
                                                          // $howdy is not used
                                                      }
                                                  }

                                                  Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

                                                  Avoid unused parameters such as '$code'.
                                                  Open

                                                              $code = null,
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  UnusedFormalParameter

                                                  Since: 0.2

                                                  Avoid passing parameters to methods or constructors and then not using those parameters.

                                                  Example

                                                  class Foo
                                                  {
                                                      private function bar($howdy)
                                                      {
                                                          // $howdy is not used
                                                      }
                                                  }

                                                  Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

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

                                                                          } elseif (('[' === $chrs[$c])
                                                                                    && in_array($top['what'], [SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ], true)) {
                                                                              // found a left-bracket, and we are in an array, object, or slice
                                                                              array_push($stk, ['what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false]);
                                                                              //print("Found start of array at {$c}\n");
                                                  Severity: Minor
                                                  Found in class/JSON.php and 1 other location - About 30 mins to fix
                                                  class/JSON.php on lines 672..677

                                                  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 91.

                                                  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

                                                                          } elseif (('{' === $chrs[$c])
                                                                                    && in_array($top['what'], [SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ], true)) {
                                                                              // found a left-brace, and we are in an array, object, or slice
                                                                              array_push($stk, ['what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false]);
                                                                              //print("Found start of object at {$c}\n");
                                                  Severity: Minor
                                                  Found in class/JSON.php and 1 other location - About 30 mins to fix
                                                  class/JSON.php on lines 663..668

                                                  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 91.

                                                  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

                                                  Each class must be in a namespace of at least one level (a top-level vendor name)
                                                  Open

                                                      class ServicesJSON_Error
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpcodesniffer

                                                  Each class must be in a namespace of at least one level (a top-level vendor name)
                                                  Open

                                                  class ServicesJSON
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpcodesniffer

                                                  Each class must be in a namespace of at least one level (a top-level vendor name)
                                                  Open

                                                      class ServicesJSON_Error extends PEAR_Error
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpcodesniffer

                                                  The class ServicesJSON_Error is not named in CamelCase.
                                                  Open

                                                      class ServicesJSON_Error
                                                      {
                                                          /**
                                                           * ServicesJSON_Error constructor.
                                                           * @param string $message
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseClassName

                                                  Since: 0.2

                                                  It is considered best practice to use the CamelCase notation to name classes.

                                                  Example

                                                  class class_name {
                                                  }

                                                  Source

                                                  Avoid variables with short names like $lc. Configured minimum length is 3.
                                                  Open

                                                          $lc = setlocale(LC_NUMERIC, 0);
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  ShortVariable

                                                  Since: 0.2

                                                  Detects when a field, local, or parameter has a very short name.

                                                  Example

                                                  class Something {
                                                      private $q = 15; // VIOLATION - Field
                                                      public static function main( array $as ) { // VIOLATION - Formal
                                                          $r = 20 + $this->q; // VIOLATION - Local
                                                          for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                                              $r += $this->q;
                                                          }
                                                      }
                                                  }

                                                  Source https://phpmd.org/rules/naming.html#shortvariable

                                                  The class ServicesJSON_Error is not named in CamelCase.
                                                  Open

                                                      class ServicesJSON_Error extends PEAR_Error
                                                      {
                                                          /**
                                                           * ServicesJSON_Error constructor.
                                                           * @param string $message
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseClassName

                                                  Since: 0.2

                                                  It is considered best practice to use the CamelCase notation to name classes.

                                                  Example

                                                  class class_name {
                                                  }

                                                  Source

                                                  Avoid variables with short names like $m. Configured minimum length is 3.
                                                  Open

                                                                  $m = [];
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  ShortVariable

                                                  Since: 0.2

                                                  Detects when a field, local, or parameter has a very short name.

                                                  Example

                                                  class Something {
                                                      private $q = 15; // VIOLATION - Field
                                                      public static function main( array $as ) { // VIOLATION - Formal
                                                          $r = 20 + $this->q; // VIOLATION - Local
                                                          for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                                              $r += $this->q;
                                                          }
                                                      }
                                                  }

                                                  Source https://phpmd.org/rules/naming.html#shortvariable

                                                  Each class must be in a file by itself
                                                  Open

                                                      class ServicesJSON_Error extends PEAR_Error
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpcodesniffer

                                                  Each class must be in a file by itself
                                                  Open

                                                      class ServicesJSON_Error
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpcodesniffer

                                                  Method name "_encode" should not be prefixed with an underscore to indicate visibility
                                                  Open

                                                      public function _encode($var)
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpcodesniffer

                                                  Method name "ServicesJSON::name_value" is not in camel caps format
                                                  Open

                                                      public function name_value($name, $value)
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpcodesniffer

                                                  Method name "ServicesJSON::reduce_string" is not in camel caps format
                                                  Open

                                                      public function reduce_string($str): string
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpcodesniffer

                                                  Line exceeds 120 characters; contains 156 characters
                                                  Open

                                                                  return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS) ? 'null' : new ServicesJSON_Error(gettype($var) . ' can not be encoded as JSON string');
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpcodesniffer

                                                  Line exceeds 120 characters; contains 135 characters
                                                  Open

                                                                                    && in_array($top['what'], [SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ], true)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpcodesniffer

                                                  Line exceeds 120 characters; contains 152 characters
                                                  Open

                                                                  return chr((0xF0 & (ord($utf8[0]) << 4)) | (0x0F & (ord($utf8[1]) >> 2))) . chr((0xC0 & (ord($utf8[1]) << 6)) | (0x7F & ord($utf8[2])));
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpcodesniffer

                                                  Line exceeds 120 characters; contains 125 characters
                                                  Open

                                                                                  $utf16 = chr(hexdec(mb_substr($chrs, $c + 2, 2))) . chr(hexdec(mb_substr($chrs, $c + 4, 2)));
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpcodesniffer

                                                  Line exceeds 120 characters; contains 136 characters
                                                  Open

                                                                              $char  = pack('C*', $ord_var_c, ord($var[$c + 1]), ord($var[$c + 2]), ord($var[$c + 3]), ord($var[$c + 4]));
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpcodesniffer

                                                  Line exceeds 120 characters; contains 121 characters
                                                  Open

                                                                              //print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpcodesniffer

                                                  Line exceeds 120 characters; contains 133 characters
                                                  Open

                                                                              //print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpcodesniffer

                                                  Line exceeds 120 characters; contains 126 characters
                                                  Open

                                                                  return chr(0xE0 | (($bytes >> 12) & 0x0F)) . chr(0x80 | (($bytes >> 6) & 0x3F)) . chr(0x80 | ($bytes & 0x3F));
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpcodesniffer

                                                  Line exceeds 120 characters; contains 155 characters
                                                  Open

                                                                              $char  = pack('C*', $ord_var_c, ord($var[$c + 1]), ord($var[$c + 2]), ord($var[$c + 3]), ord($var[$c + 4]), ord($var[$c + 5]));
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpcodesniffer

                                                  Line exceeds 120 characters; contains 123 characters
                                                  Open

                                                                          } elseif ((('"' === $chrs[$c]) || ("'" === $chrs[$c])) && (SERVICES_JSON_IN_STR != $top['what'])) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpcodesniffer

                                                  Line exceeds 120 characters; contains 128 characters
                                                  Open

                                                                              //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpcodesniffer

                                                  Line exceeds 120 characters; contains 135 characters
                                                  Open

                                                                                    && in_array($top['what'], [SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ], true)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpcodesniffer

                                                  Line exceeds 120 characters; contains 129 characters
                                                  Open

                                                                              //print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpcodesniffer

                                                  Line exceeds 120 characters; contains 130 characters
                                                  Open

                                                                              //print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpcodesniffer

                                                  Line exceeds 120 characters; contains 137 characters
                                                  Open

                                                                                    && (1 != (mb_strlen(mb_substr($chrs, 0, $c)) - mb_strlen(rtrim(mb_substr($chrs, 0, $c), '\\'))) % 2)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpcodesniffer

                                                  Line exceeds 120 characters; contains 135 characters
                                                  Open

                                                                                    && in_array($top['what'], [SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ], true)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpcodesniffer

                                                  Class name "ServicesJSON_Error" is not in camel caps format
                                                  Open

                                                      class ServicesJSON_Error
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpcodesniffer

                                                  Closing brace indented incorrectly; expected 24 spaces, found 20
                                                  Open

                                                                      }
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpcodesniffer

                                                  Closing brace indented incorrectly; expected 20 spaces, found 24
                                                  Open

                                                                          } else {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpcodesniffer

                                                  Line indented incorrectly; expected 20 spaces, found 24
                                                  Open

                                                                          } else {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpcodesniffer

                                                  Class name "ServicesJSON_Error" is not in camel caps format
                                                  Open

                                                      class ServicesJSON_Error extends PEAR_Error
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpcodesniffer

                                                  The variable $ord_var_c is not named in camelCase.
                                                  Open

                                                      public function _encode($var)
                                                      {
                                                          switch (gettype($var)) {
                                                              case 'boolean':
                                                                  return $var ? 'true' : 'false';
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $ord_var_c is not named in camelCase.
                                                  Open

                                                      public function _encode($var)
                                                      {
                                                          switch (gettype($var)) {
                                                              case 'boolean':
                                                                  return $var ? 'true' : 'false';
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $ord_chrs_c is not named in camelCase.
                                                  Open

                                                      public function decode($str)
                                                      {
                                                          $str = $this->reduce_string($str);
                                                  
                                                          switch (mb_strtolower($str)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $strlen_chrs is not named in camelCase.
                                                  Open

                                                      public function decode($str)
                                                      {
                                                          $str = $this->reduce_string($str);
                                                  
                                                          switch (mb_strtolower($str)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $strlen_var is not named in camelCase.
                                                  Open

                                                      public function _encode($var)
                                                      {
                                                          switch (gettype($var)) {
                                                              case 'boolean':
                                                                  return $var ? 'true' : 'false';
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $ord_var_c is not named in camelCase.
                                                  Open

                                                      public function _encode($var)
                                                      {
                                                          switch (gettype($var)) {
                                                              case 'boolean':
                                                                  return $var ? 'true' : 'false';
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $ord_chrs_c is not named in camelCase.
                                                  Open

                                                      public function decode($str)
                                                      {
                                                          $str = $this->reduce_string($str);
                                                  
                                                          switch (mb_strtolower($str)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $ord_var_c is not named in camelCase.
                                                  Open

                                                      public function _encode($var)
                                                      {
                                                          switch (gettype($var)) {
                                                              case 'boolean':
                                                                  return $var ? 'true' : 'false';
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $strlen_var is not named in camelCase.
                                                  Open

                                                      public function _encode($var)
                                                      {
                                                          switch (gettype($var)) {
                                                              case 'boolean':
                                                                  return $var ? 'true' : 'false';
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $substr_chrs_c_2 is not named in camelCase.
                                                  Open

                                                      public function decode($str)
                                                      {
                                                          $str = $this->reduce_string($str);
                                                  
                                                          switch (mb_strtolower($str)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $ord_chrs_c is not named in camelCase.
                                                  Open

                                                      public function decode($str)
                                                      {
                                                          $str = $this->reduce_string($str);
                                                  
                                                          switch (mb_strtolower($str)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $strlen_chrs is not named in camelCase.
                                                  Open

                                                      public function decode($str)
                                                      {
                                                          $str = $this->reduce_string($str);
                                                  
                                                          switch (mb_strtolower($str)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $encoded_value is not named in camelCase.
                                                  Open

                                                      public function name_value($name, $value)
                                                      {
                                                          $encoded_value = $this->_encode($value);
                                                  
                                                          if ($this->isError($encoded_value)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $substr_chrs_c_2 is not named in camelCase.
                                                  Open

                                                      public function decode($str)
                                                      {
                                                          $str = $this->reduce_string($str);
                                                  
                                                          switch (mb_strtolower($str)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $ord_chrs_c is not named in camelCase.
                                                  Open

                                                      public function decode($str)
                                                      {
                                                          $str = $this->reduce_string($str);
                                                  
                                                          switch (mb_strtolower($str)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $ord_chrs_c is not named in camelCase.
                                                  Open

                                                      public function decode($str)
                                                      {
                                                          $str = $this->reduce_string($str);
                                                  
                                                          switch (mb_strtolower($str)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $strlen_var is not named in camelCase.
                                                  Open

                                                      public function _encode($var)
                                                      {
                                                          switch (gettype($var)) {
                                                              case 'boolean':
                                                                  return $var ? 'true' : 'false';
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $ord_var_c is not named in camelCase.
                                                  Open

                                                      public function _encode($var)
                                                      {
                                                          switch (gettype($var)) {
                                                              case 'boolean':
                                                                  return $var ? 'true' : 'false';
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $ord_var_c is not named in camelCase.
                                                  Open

                                                      public function _encode($var)
                                                      {
                                                          switch (gettype($var)) {
                                                              case 'boolean':
                                                                  return $var ? 'true' : 'false';
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $ord_var_c is not named in camelCase.
                                                  Open

                                                      public function _encode($var)
                                                      {
                                                          switch (gettype($var)) {
                                                              case 'boolean':
                                                                  return $var ? 'true' : 'false';
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $strlen_var is not named in camelCase.
                                                  Open

                                                      public function _encode($var)
                                                      {
                                                          switch (gettype($var)) {
                                                              case 'boolean':
                                                                  return $var ? 'true' : 'false';
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $ord_var_c is not named in camelCase.
                                                  Open

                                                      public function _encode($var)
                                                      {
                                                          switch (gettype($var)) {
                                                              case 'boolean':
                                                                  return $var ? 'true' : 'false';
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $encoded_value is not named in camelCase.
                                                  Open

                                                      public function name_value($name, $value)
                                                      {
                                                          $encoded_value = $this->_encode($value);
                                                  
                                                          if ($this->isError($encoded_value)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $substr_chrs_c_2 is not named in camelCase.
                                                  Open

                                                      public function decode($str)
                                                      {
                                                          $str = $this->reduce_string($str);
                                                  
                                                          switch (mb_strtolower($str)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $ord_var_c is not named in camelCase.
                                                  Open

                                                      public function _encode($var)
                                                      {
                                                          switch (gettype($var)) {
                                                              case 'boolean':
                                                                  return $var ? 'true' : 'false';
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $substr_chrs_c_2 is not named in camelCase.
                                                  Open

                                                      public function decode($str)
                                                      {
                                                          $str = $this->reduce_string($str);
                                                  
                                                          switch (mb_strtolower($str)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $substr_chrs_c_2 is not named in camelCase.
                                                  Open

                                                      public function decode($str)
                                                      {
                                                          $str = $this->reduce_string($str);
                                                  
                                                          switch (mb_strtolower($str)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $ord_var_c is not named in camelCase.
                                                  Open

                                                      public function _encode($var)
                                                      {
                                                          switch (gettype($var)) {
                                                              case 'boolean':
                                                                  return $var ? 'true' : 'false';
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $strlen_var is not named in camelCase.
                                                  Open

                                                      public function _encode($var)
                                                      {
                                                          switch (gettype($var)) {
                                                              case 'boolean':
                                                                  return $var ? 'true' : 'false';
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $substr_chrs_c_2 is not named in camelCase.
                                                  Open

                                                      public function decode($str)
                                                      {
                                                          $str = $this->reduce_string($str);
                                                  
                                                          switch (mb_strtolower($str)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $substr_chrs_c_2 is not named in camelCase.
                                                  Open

                                                      public function decode($str)
                                                      {
                                                          $str = $this->reduce_string($str);
                                                  
                                                          switch (mb_strtolower($str)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $strlen_chrs is not named in camelCase.
                                                  Open

                                                      public function decode($str)
                                                      {
                                                          $str = $this->reduce_string($str);
                                                  
                                                          switch (mb_strtolower($str)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $substr_chrs_c_2 is not named in camelCase.
                                                  Open

                                                      public function decode($str)
                                                      {
                                                          $str = $this->reduce_string($str);
                                                  
                                                          switch (mb_strtolower($str)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $ord_chrs_c is not named in camelCase.
                                                  Open

                                                      public function decode($str)
                                                      {
                                                          $str = $this->reduce_string($str);
                                                  
                                                          switch (mb_strtolower($str)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $substr_chrs_c_2 is not named in camelCase.
                                                  Open

                                                      public function decode($str)
                                                      {
                                                          $str = $this->reduce_string($str);
                                                  
                                                          switch (mb_strtolower($str)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $encoded_value is not named in camelCase.
                                                  Open

                                                      public function name_value($name, $value)
                                                      {
                                                          $encoded_value = $this->_encode($value);
                                                  
                                                          if ($this->isError($encoded_value)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $ord_var_c is not named in camelCase.
                                                  Open

                                                      public function _encode($var)
                                                      {
                                                          switch (gettype($var)) {
                                                              case 'boolean':
                                                                  return $var ? 'true' : 'false';
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $ord_var_c is not named in camelCase.
                                                  Open

                                                      public function _encode($var)
                                                      {
                                                          switch (gettype($var)) {
                                                              case 'boolean':
                                                                  return $var ? 'true' : 'false';
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $ord_var_c is not named in camelCase.
                                                  Open

                                                      public function _encode($var)
                                                      {
                                                          switch (gettype($var)) {
                                                              case 'boolean':
                                                                  return $var ? 'true' : 'false';
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $ord_var_c is not named in camelCase.
                                                  Open

                                                      public function _encode($var)
                                                      {
                                                          switch (gettype($var)) {
                                                              case 'boolean':
                                                                  return $var ? 'true' : 'false';
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $encoded_value is not named in camelCase.
                                                  Open

                                                      public function name_value($name, $value)
                                                      {
                                                          $encoded_value = $this->_encode($value);
                                                  
                                                          if ($this->isError($encoded_value)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $substr_chrs_c_2 is not named in camelCase.
                                                  Open

                                                      public function decode($str)
                                                      {
                                                          $str = $this->reduce_string($str);
                                                  
                                                          switch (mb_strtolower($str)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $substr_chrs_c_2 is not named in camelCase.
                                                  Open

                                                      public function decode($str)
                                                      {
                                                          $str = $this->reduce_string($str);
                                                  
                                                          switch (mb_strtolower($str)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $ord_var_c is not named in camelCase.
                                                  Open

                                                      public function _encode($var)
                                                      {
                                                          switch (gettype($var)) {
                                                              case 'boolean':
                                                                  return $var ? 'true' : 'false';
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $substr_chrs_c_2 is not named in camelCase.
                                                  Open

                                                      public function decode($str)
                                                      {
                                                          $str = $this->reduce_string($str);
                                                  
                                                          switch (mb_strtolower($str)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $strlen_chrs is not named in camelCase.
                                                  Open

                                                      public function decode($str)
                                                      {
                                                          $str = $this->reduce_string($str);
                                                  
                                                          switch (mb_strtolower($str)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $ord_var_c is not named in camelCase.
                                                  Open

                                                      public function _encode($var)
                                                      {
                                                          switch (gettype($var)) {
                                                              case 'boolean':
                                                                  return $var ? 'true' : 'false';
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $ord_var_c is not named in camelCase.
                                                  Open

                                                      public function _encode($var)
                                                      {
                                                          switch (gettype($var)) {
                                                              case 'boolean':
                                                                  return $var ? 'true' : 'false';
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $ord_var_c is not named in camelCase.
                                                  Open

                                                      public function _encode($var)
                                                      {
                                                          switch (gettype($var)) {
                                                              case 'boolean':
                                                                  return $var ? 'true' : 'false';
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $ord_chrs_c is not named in camelCase.
                                                  Open

                                                      public function decode($str)
                                                      {
                                                          $str = $this->reduce_string($str);
                                                  
                                                          switch (mb_strtolower($str)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $ord_chrs_c is not named in camelCase.
                                                  Open

                                                      public function decode($str)
                                                      {
                                                          $str = $this->reduce_string($str);
                                                  
                                                          switch (mb_strtolower($str)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $substr_chrs_c_2 is not named in camelCase.
                                                  Open

                                                      public function decode($str)
                                                      {
                                                          $str = $this->reduce_string($str);
                                                  
                                                          switch (mb_strtolower($str)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $strlen_var is not named in camelCase.
                                                  Open

                                                      public function _encode($var)
                                                      {
                                                          switch (gettype($var)) {
                                                              case 'boolean':
                                                                  return $var ? 'true' : 'false';
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $ord_var_c is not named in camelCase.
                                                  Open

                                                      public function _encode($var)
                                                      {
                                                          switch (gettype($var)) {
                                                              case 'boolean':
                                                                  return $var ? 'true' : 'false';
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $strlen_chrs is not named in camelCase.
                                                  Open

                                                      public function decode($str)
                                                      {
                                                          $str = $this->reduce_string($str);
                                                  
                                                          switch (mb_strtolower($str)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $ord_var_c is not named in camelCase.
                                                  Open

                                                      public function _encode($var)
                                                      {
                                                          switch (gettype($var)) {
                                                              case 'boolean':
                                                                  return $var ? 'true' : 'false';
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $ord_var_c is not named in camelCase.
                                                  Open

                                                      public function _encode($var)
                                                      {
                                                          switch (gettype($var)) {
                                                              case 'boolean':
                                                                  return $var ? 'true' : 'false';
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $substr_chrs_c_2 is not named in camelCase.
                                                  Open

                                                      public function decode($str)
                                                      {
                                                          $str = $this->reduce_string($str);
                                                  
                                                          switch (mb_strtolower($str)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $strlen_var is not named in camelCase.
                                                  Open

                                                      public function _encode($var)
                                                      {
                                                          switch (gettype($var)) {
                                                              case 'boolean':
                                                                  return $var ? 'true' : 'false';
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The variable $substr_chrs_c_2 is not named in camelCase.
                                                  Open

                                                      public function decode($str)
                                                      {
                                                          $str = $this->reduce_string($str);
                                                  
                                                          switch (mb_strtolower($str)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseVariableName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name variables.

                                                  Example

                                                  class ClassName {
                                                      public function doSomething() {
                                                          $data_module = new DataModule();
                                                      }
                                                  }

                                                  Source

                                                  The method reduce_string is not named in camelCase.
                                                  Open

                                                      public function reduce_string($str): string
                                                      {
                                                          $str = preg_replace(
                                                              [
                                                                  // eliminate single line comments in '// ...' form
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseMethodName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name methods.

                                                  Example

                                                  class ClassName {
                                                      public function get_name() {
                                                      }
                                                  }

                                                  Source

                                                  The method _encode is not named in camelCase.
                                                  Open

                                                      public function _encode($var)
                                                      {
                                                          switch (gettype($var)) {
                                                              case 'boolean':
                                                                  return $var ? 'true' : 'false';
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseMethodName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name methods.

                                                  Example

                                                  class ClassName {
                                                      public function get_name() {
                                                      }
                                                  }

                                                  Source

                                                  The method name_value is not named in camelCase.
                                                  Open

                                                      public function name_value($name, $value)
                                                      {
                                                          $encoded_value = $this->_encode($value);
                                                  
                                                          if ($this->isError($encoded_value)) {
                                                  Severity: Minor
                                                  Found in class/JSON.php by phpmd

                                                  CamelCaseMethodName

                                                  Since: 0.2

                                                  It is considered best practice to use the camelCase notation to name methods.

                                                  Example

                                                  class ClassName {
                                                      public function get_name() {
                                                      }
                                                  }

                                                  Source

                                                  There are no issues that match your filters.

                                                  Category
                                                  Status