XoopsModules25x/xoopsinfo

View on GitHub
phpsysinfo/includes/js/class.JavaScriptPacker.inc.php

Summary

Maintainability
D
2 days
Test Coverage

File class.JavaScriptPacker.inc.php has 474 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/* 25 October 2011. version 1.1-FF4
 *
 * This is the php version of the Dean Edwards JavaScript's Packer,
 * Based on :
Severity: Minor
Found in phpsysinfo/includes/js/class.JavaScriptPacker.inc.php - About 7 hrs to fix

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

    class JavaScriptPacker
    {
        // constants
        const IGNORE = '$1';
    
    

    JavaScriptPacker has 23 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class JavaScriptPacker
    {
        // constants
        const IGNORE = '$1';
    
    
    Severity: Minor
    Found in phpsysinfo/includes/js/class.JavaScriptPacker.inc.php - About 2 hrs to fix

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

          private function _bootStrap($packed, $keywords)
          {
              $ENCODE = $this->_safeRegExp('$encode\\($count\\)');
      
              // $packed: the packed script
      Severity: Minor
      Found in phpsysinfo/includes/js/class.JavaScriptPacker.inc.php - About 1 hr to fix

        Function _replacement has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            private function _replacement($arguments)
            {
                if (empty($arguments)) return '';
        
                $i = 1; $j = 0;
        Severity: Minor
        Found in phpsysinfo/includes/js/class.JavaScriptPacker.inc.php - About 1 hr to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

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

            private function _bootStrap($packed, $keywords)
            {
                $ENCODE = $this->_safeRegExp('$encode\\($count\\)');
        
                // $packed: the packed script
        Severity: Minor
        Found in phpsysinfo/includes/js/class.JavaScriptPacker.inc.php - About 1 hr to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Method _analyze has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function _analyze($script, $regexp, $encode)
            {
                // analyse
                // retreive all words in the script
                $all = array();
        Severity: Minor
        Found in phpsysinfo/includes/js/class.JavaScriptPacker.inc.php - About 1 hr to fix

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

              public function add($expression, $replacement = '')
              {
                  // count the number of sub-expressions
                  //  - add one because each pattern is itself a sub-expression
                  $length = 1 + preg_match_all($this->GROUPS, $this->_internalEscape((string) $expression), $out);
          Severity: Minor
          Found in phpsysinfo/includes/js/class.JavaScriptPacker.inc.php - About 55 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

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

              private function _analyze($script, $regexp, $encode)
              {
                  // analyse
                  // retreive all words in the script
                  $all = array();
          Severity: Minor
          Found in phpsysinfo/includes/js/class.JavaScriptPacker.inc.php - About 35 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          The method _bootStrap() has an NPath complexity of 3584. The configured NPath complexity threshold is 200.
          Open

              private function _bootStrap($packed, $keywords)
              {
                  $ENCODE = $this->_safeRegExp('$encode\\($count\\)');
          
                  // $packed: the packed script

          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 _bootStrap() has a Cyclomatic Complexity of 15. The configured cyclomatic complexity threshold is 10.
          Open

              private function _bootStrap($packed, $keywords)
              {
                  $ENCODE = $this->_safeRegExp('$encode\\($count\\)');
          
                  // $packed: the packed script

          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 _replacement() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
          Open

              private function _replacement($arguments)
              {
                  if (empty($arguments)) return '';
          
                  $i = 1; $j = 0;

          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

          Avoid using undefined variables such as '$values' which will lead to PHP notices.
          Open

                              $values[$j] = call_user_func(array(&$this, $encode), $j);

          UndefinedVariable

          Since: 2.8.0

          Detects when a variable is used that has not been defined before.

          Example

          class Foo
          {
              private function bar()
              {
                  // $message is undefined
                  echo $message;
              }
          }

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

          Avoid using undefined variables such as '$values' which will lead to PHP notices.
          Open

                              $protected['$' . $values[$j]] = $j++;

          UndefinedVariable

          Since: 2.8.0

          Detects when a variable is used that has not been defined before.

          Example

          class Foo
          {
              private function bar()
              {
                  // $message is undefined
                  echo $message;
              }
          }

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

          Avoid using undefined variables such as '$values' which will lead to PHP notices.
          Open

                          $_encoded[$_sorted[$i]] = $values[$i];

          UndefinedVariable

          Since: 2.8.0

          Detects when a variable is used that has not been defined before.

          Example

          class Foo
          {
              private function bar()
              {
                  // $message is undefined
                  echo $message;
              }
          }

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

          Missing class import via use statement (line '160', column '23').
          Open

                  $parser = new ParseMaster();

          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 '130', column '23').
          Open

                  $parser = new ParseMaster();

          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 '358', column '29').
          Open

                  $unpackPacker = new JavaScriptPacker($unpack, 0, false, true);

          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 '188', column '23').
          Open

                  $parser = new ParseMaster();

          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 __construct has a boolean flag argument $_fastDecode, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public function __construct($_script, $_encoding = 62, $_fastDecode = true, $_specialChars = false)

          BooleanArgumentFlag

          Since: 1.4.0

          A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

          Example

          class Foo {
              public function bar($flag = true) {
              }
          }

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

          The method __construct has a boolean flag argument $_specialChars, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public function __construct($_script, $_encoding = 62, $_fastDecode = true, $_specialChars = false)

          BooleanArgumentFlag

          Since: 1.4.0

          A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

          Example

          class Foo {
              public function bar($flag = true) {
              }
          }

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

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

                      } else {
                          $i += $pattern[self::LENGTH];
                      }

          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 _encodeKeywords uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                  else {
                      //$res = $parser->exec($script);
                      //$res = $this->_bootStrap($res, $keywords);
                      //return $res;
                      return $this->_bootStrap($parser->exec($script), $keywords);

          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 _escape uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                  } else {
                      return $string;
                  }

          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 _unescape uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                  } else {
                      return $string;
                  }

          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 _unescapeBis uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                  } else {
                      $temp = '';
                  }

          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 _bootStrap uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                  } else {
                      // perform the encoding inline
                      $unpack = preg_replace($ENCODE, $inline, $unpack);
                  }

          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 add uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                          } else { // a complicated lookup (e.g. "Hello $2 $1")
                              // build a function to do the lookup
                              $quote = preg_match($this->QUOTE, $this->_internalEscape($replacement))
                                       ? '"' : "'";
                              $replacement = array(

          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 private methods such as '_basicCompression'.
          Open

              private function _basicCompression($script)
              {
                  $parser = new ParseMaster();
                  // make safe
                  $parser->escapeChar = '\\';

          UnusedPrivateMethod

          Since: 0.2

          Unused Private Method detects when a private method is declared but is unused.

          Example

          class Something
          {
              private function foo() {} // unused
          }

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

          Avoid unused local variables such as '$value'.
          Open

                      $value = array(); // dictionary of charCode->encoding (eg. 256->ff)

          UnusedLocalVariable

          Since: 0.2

          Detects when a local variable is declared and/or assigned, but not used.

          Example

          class Foo {
              public function doSomething()
              {
                  $i = 5; // Unused
              }
          }

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

          Avoid unused private methods such as '_encodePrivate'.
          Open

              private function _encodePrivate($charCode)
              {
                  return "_" . $charCode;
              }

          UnusedPrivateMethod

          Since: 0.2

          Unused Private Method detects when a private method is declared but is unused.

          Example

          class Something
          {
              private function foo() {} // unused
          }

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

          Avoid unused private methods such as '_escapeBis'.
          Open

              private function _escapeBis($match)
              {
                  $this->_escaped[] = $match[1];
          
                  return $this->buffer;

          UnusedPrivateMethod

          Since: 0.2

          Unused Private Method detects when a private method is declared but is unused.

          Example

          class Something
          {
              private function foo() {} // unused
          }

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

          Avoid unused parameters such as '$match'.
          Open

              private function _insertFastDecode($match)

          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 private methods such as '_insertFastEncode'.
          Open

              private function _insertFastEncode($match)
              {
                  return '{$encode=' . $this->buffer . ';';
              }

          UnusedPrivateMethod

          Since: 0.2

          Unused Private Method detects when a private method is declared but is unused.

          Example

          class Something
          {
              private function foo() {} // unused
          }

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

          Avoid unused private methods such as '_escape95Bis'.
          Open

              private function _escape95Bis($match)
              {
                  return '\x'.((string) dechex(ord($match)));
              }

          UnusedPrivateMethod

          Since: 0.2

          Unused Private Method detects when a private method is declared but is unused.

          Example

          class Something
          {
              private function foo() {} // unused
          }

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

          Avoid unused private fields such as '$TRIM'.
          Open

              private $TRIM = '/([\'"])\\1\\.(.*)\\.\\1\\1$/';

          UnusedPrivateField

          Since: 0.2

          Detects when a private field is declared and/or assigned a value, but not used.

          Example

          class Something
          {
              private static $FOO = 2; // Unused
              private $i = 5; // Unused
              private $j = 6;
              public function addOne()
              {
                  return $this->j++;
              }
          }

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

          Avoid unused private methods such as '_replace_name'.
          Open

              private function _replace_name($match, $offset)
              {
                  $length = strlen($match[$offset + 2]);
                  $start = $length - max($length - strlen($match[$offset + 3]), 0);
          
          

          UnusedPrivateMethod

          Since: 0.2

          Unused Private Method detects when a private method is declared but is unused.

          Example

          class Something
          {
              private function foo() {} // unused
          }

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

          Avoid unused local variables such as '$value'.
          Open

                  foreach ($keywords['protected'] as $i=>$value) {

          UnusedLocalVariable

          Since: 0.2

          Detects when a local variable is declared and/or assigned, but not used.

          Example

          class Foo {
              public function doSomething()
              {
                  $i = 5; // Unused
              }
          }

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

          Avoid unused private methods such as '_encodeSpecialChars'.
          Open

              private function _encodeSpecialChars($script)
              {
                  $parser = new ParseMaster();
                  // replace: $name -> n, $$name -> na
                  $parser->add('/((\\x24+)([a-zA-Z$_]+))(\\d*)/',

          UnusedPrivateMethod

          Since: 0.2

          Unused Private Method detects when a private method is declared but is unused.

          Example

          class Something
          {
              private function foo() {} // unused
          }

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

          Avoid unused private methods such as '_insertFastDecode'.
          Open

              private function _insertFastDecode($match)
              {
                  return '{' . $this->buffer . ';';
              }

          UnusedPrivateMethod

          Since: 0.2

          Unused Private Method detects when a private method is declared but is unused.

          Example

          class Something
          {
              private function foo() {} // unused
          }

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

          Avoid unused private methods such as '_replace_encoded'.
          Open

              private function _replace_encoded($match, $offset)
              {
                  return $this->buffer[$match[$offset]];
              }

          UnusedPrivateMethod

          Since: 0.2

          Unused Private Method detects when a private method is declared but is unused.

          Example

          class Something
          {
              private function foo() {} // unused
          }

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

          Avoid unused private methods such as '_unescapeBis'.
          Open

              private function _unescapeBis()
              {
                  if (isset($this->_escaped[$this->buffer['i']])
                      && $this->_escaped[$this->buffer['i']] != '')
                  {

          UnusedPrivateMethod

          Since: 0.2

          Unused Private Method detects when a private method is declared but is unused.

          Example

          class Something
          {
              private function foo() {} // unused
          }

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

          Avoid unused parameters such as '$match'.
          Open

              private function _insertFastEncode($match)

          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 local variables such as '$out'.
          Open

                  $length = 1 + preg_match_all($this->GROUPS, $this->_internalEscape((string) $expression), $out);

          UnusedLocalVariable

          Since: 0.2

          Detects when a local variable is declared and/or assigned, but not used.

          Example

          class Foo {
              public function doSomething()
              {
                  $i = 5; // Unused
              }
          }

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

          Avoid unused private methods such as '_backReferences'.
          Open

              private function _backReferences($match, $offset)
              {
                  $replacement = $this->buffer['replacement'];
                  $quote = $this->buffer['quote'];
                  $i = $this->buffer['length'];

          UnusedPrivateMethod

          Since: 0.2

          Unused Private Method detects when a private method is declared but is unused.

          Example

          class Something
          {
              private function foo() {} // unused
          }

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

          Avoid unused private methods such as '_sortWords'.
          Open

              private function _sortWords($match1, $match2)
              {
                  return $this->_count[$match2] - $this->_count[$match1];
              }

          UnusedPrivateMethod

          Since: 0.2

          Unused Private Method detects when a private method is declared but is unused.

          Example

          class Something
          {
              private function foo() {} // unused
          }

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

          Avoid unused private methods such as '_encode36'.
          Open

              private function _encode36($charCode)
              {
                  return base_convert($charCode, 10, 36);
              }

          UnusedPrivateMethod

          Since: 0.2

          Unused Private Method detects when a private method is declared but is unused.

          Example

          class Something
          {
              private function foo() {} // unused
          }

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

          Avoid unused private methods such as '_encodeKeywords'.
          Open

              private function _encodeKeywords($script)
              {
                  // escape high-ascii values already in the script (i.e. in strings)
                  if ($this->_encoding > 62)
                      $script = $this->_escape95($script);

          UnusedPrivateMethod

          Since: 0.2

          Unused Private Method detects when a private method is declared but is unused.

          Example

          class Something
          {
              private function foo() {} // unused
          }

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

          Avoid unused private methods such as '_replacement'.
          Open

              private function _replacement($arguments)
              {
                  if (empty($arguments)) return '';
          
                  $i = 1; $j = 0;

          UnusedPrivateMethod

          Since: 0.2

          Unused Private Method detects when a private method is declared but is unused.

          Example

          class Something
          {
              private function foo() {} // unused
          }

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

          Avoid unused local variables such as '$quote'.
          Open

                  $quote = $this->buffer['quote'];

          UnusedLocalVariable

          Since: 0.2

          Detects when a local variable is declared and/or assigned, but not used.

          Example

          class Foo {
              public function doSomething()
              {
                  $i = 5; // Unused
              }
          }

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

          Avoid unused private methods such as '_encode10'.
          Open

              private function _encode10($charCode)
              {
                  return $charCode;
              }

          UnusedPrivateMethod

          Since: 0.2

          Unused Private Method detects when a private method is declared but is unused.

          Example

          class Something
          {
              private function foo() {} // unused
          }

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

          Avoid using count() function in do loops.
          Open

                      do {
                          if (!isset($_sorted[$i]))
                              $_sorted[$i] = substr($unsorted[$j++], 1);
                          $_encoded[$_sorted[$i]] = $values[$i];
                      } while (++$i < count($unsorted));

          CountInLoopExpression

          Since: 2.7.0

          Using count/sizeof in loops expressions is considered bad practice and is a potential source of many bugs, especially when the loop manipulates an array, as count happens on each iteration.

          Example

          class Foo {
          
            public function bar()
            {
              $array = array();
          
              for ($i = 0; count($array); $i++) {
                // ...
              }
            }
          }

          Source https://phpmd.org/rules/design.html#countinloopexpression

          BUG found
          Open

           * KNOWN BUG: erroneous behavior when using escapeChar with a replacement

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

          class ParseMaster

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

          class JavaScriptPacker

          The parameter $_script is not named in camelCase.
          Open

              public function __construct($_script, $_encoding = 62, $_fastDecode = true, $_specialChars = false)
              {
                  $this->_script = $_script . "\n";
                  if (array_key_exists($_encoding, $this->LITERAL_ENCODING))
                      $_encoding = $this->LITERAL_ENCODING[$_encoding];

          CamelCaseParameterName

          Since: 0.2

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

          Example

          class ClassName {
              public function doSomething($user_name) {
              }
          }

          Source

          The property $_patterns is not named in camelCase.
          Open

          class ParseMaster
          {
              public $ignoreCase = false;
              public $escapeChar = '';
          
          

          CamelCasePropertyName

          Since: 0.2

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

          Example

          class ClassName {
              protected $property_name;
          }

          Source

          The parameter $_specialChars is not named in camelCase.
          Open

              public function __construct($_script, $_encoding = 62, $_fastDecode = true, $_specialChars = false)
              {
                  $this->_script = $_script . "\n";
                  if (array_key_exists($_encoding, $this->LITERAL_ENCODING))
                      $_encoding = $this->LITERAL_ENCODING[$_encoding];

          CamelCaseParameterName

          Since: 0.2

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

          Example

          class ClassName {
              public function doSomething($user_name) {
              }
          }

          Source

          The property $_encoding is not named in camelCase.
          Open

          class JavaScriptPacker
          {
              // constants
              const IGNORE = '$1';
          
          

          CamelCasePropertyName

          Since: 0.2

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

          Example

          class ClassName {
              protected $property_name;
          }

          Source

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

                  $i = 1; $j = 0;

          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 property $_specialChars is not named in camelCase.
          Open

          class JavaScriptPacker
          {
              // constants
              const IGNORE = '$1';
          
          

          CamelCasePropertyName

          Since: 0.2

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

          Example

          class ClassName {
              protected $property_name;
          }

          Source

          The property $SUB_REPLACE is not named in camelCase.
          Open

          class ParseMaster
          {
              public $ignoreCase = false;
              public $escapeChar = '';
          
          

          CamelCasePropertyName

          Since: 0.2

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

          Example

          class ClassName {
              protected $property_name;
          }

          Source

          The property $_escaped is not named in camelCase.
          Open

          class ParseMaster
          {
              public $ignoreCase = false;
              public $escapeChar = '';
          
          

          CamelCasePropertyName

          Since: 0.2

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

          Example

          class ClassName {
              protected $property_name;
          }

          Source

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

                      $i = count($all); $j = 0; //$word = null;

          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 property $_fastDecode is not named in camelCase.
          Open

          class JavaScriptPacker
          {
              // constants
              const IGNORE = '$1';
          
          

          CamelCasePropertyName

          Since: 0.2

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

          Example

          class ClassName {
              protected $property_name;
          }

          Source

          The property $_count is not named in camelCase.
          Open

          class JavaScriptPacker
          {
              // constants
              const IGNORE = '$1';
          
          

          CamelCasePropertyName

          Since: 0.2

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

          Example

          class ClassName {
              protected $property_name;
          }

          Source

          The property $_parsers is not named in camelCase.
          Open

          class JavaScriptPacker
          {
              // constants
              const IGNORE = '$1';
          
          

          CamelCasePropertyName

          Since: 0.2

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

          Example

          class ClassName {
              protected $property_name;
          }

          Source

          The property $LITERAL_ENCODING is not named in camelCase.
          Open

          class JavaScriptPacker
          {
              // constants
              const IGNORE = '$1';
          
          

          CamelCasePropertyName

          Since: 0.2

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

          Example

          class ClassName {
              protected $property_name;
          }

          Source

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

                      $i = count($all); $j = 0; //$word = null;

          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 property $_script is not named in camelCase.
          Open

          class JavaScriptPacker
          {
              // constants
              const IGNORE = '$1';
          
          

          CamelCasePropertyName

          Since: 0.2

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

          Example

          class ClassName {
              protected $property_name;
          }

          Source

          The parameter $_fastDecode is not named in camelCase.
          Open

              public function __construct($_script, $_encoding = 62, $_fastDecode = true, $_specialChars = false)
              {
                  $this->_script = $_script . "\n";
                  if (array_key_exists($_encoding, $this->LITERAL_ENCODING))
                      $_encoding = $this->LITERAL_ENCODING[$_encoding];

          CamelCaseParameterName

          Since: 0.2

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

          Example

          class ClassName {
              public function doSomething($user_name) {
              }
          }

          Source

          The parameter $_encoding is not named in camelCase.
          Open

              public function __construct($_script, $_encoding = 62, $_fastDecode = true, $_specialChars = false)
              {
                  $this->_script = $_script . "\n";
                  if (array_key_exists($_encoding, $this->LITERAL_ENCODING))
                      $_encoding = $this->LITERAL_ENCODING[$_encoding];

          CamelCaseParameterName

          Since: 0.2

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

          Example

          class ClassName {
              public function doSomething($user_name) {
              }
          }

          Source

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

                  $i = $this->buffer['length'];

          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

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

                  $i = 1; $j = 0;

          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 ParseMaster

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

              private function _addParser($parser)

          Class constants must be uppercase; expected JSFUNCTION_UNPACK but found JSFUNCTION_unpack
          Open

              const JSFUNCTION_unpack =

          Blank line found at end of control structure
          Open

          
          

          Method name "ParseMaster::_replace_encoded" is not in camel caps format
          Open

              private function _replace_encoded($match, $offset)

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

              private function _bootStrap($packed, $keywords)

          Expected 1 space before "=>"; 0 found
          Open

                  foreach ($keywords['protected'] as $i=>$value) {

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

              private function _add()

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

              private function _escapeBis($match)

          Property name "$_specialChars" should not be prefixed with an underscore to indicate visibility
          Open

              private $_specialChars = false;

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

              private function _encode10($charCode)

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

              private function _backReferences($match, $offset)

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

              private function _unescape($string, $escapeChar)

          Blank line found at end of control structure
          Open

          
          

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

              private function _encode62($charCode)

          Class constants must be uppercase; expected JSFUNCTION_ENCODE36 but found JSFUNCTION_encode36
          Open

               const JSFUNCTION_encode36 =

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

              private function _getEncoder($ascii)

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

              private function _replacement($arguments)

          Property name "$_parsers" should not be prefixed with an underscore to indicate visibility
          Open

              private $_parsers = array();

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

              private function _safeRegExp($string)

          Class constants must be uppercase; expected JSFUNCTION_ENCODE95 but found JSFUNCTION_encode95
          Open

              const JSFUNCTION_encode95 =

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

              private function _encodePrivate($charCode)

          Property name "$_patterns" should not be prefixed with an underscore to indicate visibility
          Open

              private $_patterns = array(); // patterns stored by index

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

              private function _escape($script)

          Property name "$_encoding" should not be prefixed with an underscore to indicate visibility
          Open

              private $_encoding = 62;

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

              private function _escape($string, $escapeChar)

          Expected 1 space after "=>"; 0 found
          Open

                  foreach ($keywords['protected'] as $i=>$value) {

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

              private function _encode95($charCode)

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

              private function _getJSFunction($aName)

          Each PHP statement must be on a line by itself
          Open

                  $i = 1; $j = 0;

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

              private function _replace_name($match, $offset)

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

              private function _replace_encoded($match, $offset)

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

              private function _pack($script)

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

              private function _escape95Bis($match)

          The closing brace for the class must go on the next line after the body
          Open

          }

          Blank line found at end of control structure
          Open

          
          

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

              private function _basicCompression($script)

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

              private function _encodeKeywords($script)

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

              private function _insertFastEncode($match)

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

              private function _analyze($script, $regexp, $encode)

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

              private function _insertFastDecode($match)

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

              private function _encode36($charCode)

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

              private function _internalEscape($string)

          Property name "$_count" should not be prefixed with an underscore to indicate visibility
          Open

              private $_count = array();

          Class constants must be uppercase; expected JSFUNCTION_DECODEBODY but found JSFUNCTION_decodeBody
          Open

              const JSFUNCTION_decodeBody =

          Class constants must be uppercase; expected JSFUNCTION_ENCODE10 but found JSFUNCTION_encode10
          Open

               const JSFUNCTION_encode10 =

          Class constants must be uppercase; expected JSFUNCTION_ENCODE62 but found JSFUNCTION_encode62
          Open

              const JSFUNCTION_encode62 =

          Blank line found at start of control structure
          Open

                          if (is_array($replacement) && isset($replacement['fn'])) {

          Blank line found at end of control structure
          Open

          
          

          Property name "$_script" should not be prefixed with an underscore to indicate visibility
          Open

              private $_script = '';

          Each PHP statement must be on a line by itself
          Open

                      $i = count($all); $j = 0; //$word = null;

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

              private function _encodeSpecialChars($script)

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

              private function _sortWords($match1, $match2)

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

              private function _escape95($script)

          Property name "$_escaped" should not be prefixed with an underscore to indicate visibility
          Open

              private $_escaped = array();  // escaped characters

          Method name "ParseMaster::_replace_name" is not in camel caps format
          Open

              private function _replace_name($match, $offset)

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

              private function _unescapeBis()

          Property name "$_fastDecode" should not be prefixed with an underscore to indicate visibility
          Open

              private $_fastDecode = true;

          Constant JSFUNCTION_encode36 should be defined in uppercase
          Open

               const JSFUNCTION_encode36 =
          'function ($charCode) {
              return $charCode.toString(36);
          }';//;';

          ConstantNamingConventions

          Since: 0.2

          Class/Interface constant names should always be defined in uppercase.

          Example

          class Foo {
              const MY_NUM = 0; // ok
              const myTest = ""; // fail
          }

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

          Constant JSFUNCTION_decodeBody should be defined in uppercase
          Open

              const JSFUNCTION_decodeBody =
          //_decode = function () {
          // does the browser support String.replace where the
          //  replacement value is a function?
          
          

          ConstantNamingConventions

          Since: 0.2

          Class/Interface constant names should always be defined in uppercase.

          Example

          class Foo {
              const MY_NUM = 0; // ok
              const myTest = ""; // fail
          }

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

          Constant JSFUNCTION_encode95 should be defined in uppercase
          Open

              const JSFUNCTION_encode95 =
          'function ($charCode) {
              return ($charCode < _encoding ? \'\' : arguments.callee($charCode / _encoding)) +
                  String.fromCharCode($charCode % _encoding + 161);
          }';

          ConstantNamingConventions

          Since: 0.2

          Class/Interface constant names should always be defined in uppercase.

          Example

          class Foo {
              const MY_NUM = 0; // ok
              const myTest = ""; // fail
          }

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

          Constant JSFUNCTION_encode62 should be defined in uppercase
          Open

              const JSFUNCTION_encode62 =
          'function ($charCode) {
              return ($charCode < _encoding ? \'\' : arguments.callee(parseInt($charCode / _encoding))) +
              (($charCode = $charCode % _encoding) > 35 ? String.fromCharCode($charCode + 29) : $charCode.toString(36));
          }';

          ConstantNamingConventions

          Since: 0.2

          Class/Interface constant names should always be defined in uppercase.

          Example

          class Foo {
              const MY_NUM = 0; // ok
              const myTest = ""; // fail
          }

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

          Constant JSFUNCTION_encode10 should be defined in uppercase
          Open

               const JSFUNCTION_encode10 =
          'function ($charCode) {
              return $charCode;
          }';//;';

          ConstantNamingConventions

          Since: 0.2

          Class/Interface constant names should always be defined in uppercase.

          Example

          class Foo {
              const MY_NUM = 0; // ok
              const myTest = ""; // fail
          }

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

          Constant JSFUNCTION_unpack should be defined in uppercase
          Open

              const JSFUNCTION_unpack =
          
          'function ($packed, $ascii, $count, $keywords, $encode, $decode) {
              while ($count--) {
                  if ($keywords[$count]) {

          ConstantNamingConventions

          Since: 0.2

          Class/Interface constant names should always be defined in uppercase.

          Example

          class Foo {
              const MY_NUM = 0; // ok
              const myTest = ""; // fail
          }

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

          Inline control structures are not allowed
          Open

                  else $this->_add('/^$/', $replacement, $length);

          Inline control structures are not allowed
          Open

                              if (isset($replacement['data'])) $this->buffer = $replacement['data'];

          Inline control structures are not allowed
          Open

                  if (array_key_exists($_encoding, $this->LITERAL_ENCODING))

          Inline control structures are not allowed
          Open

                  if ($this->_encoding > 62)

          Inline control structures are not allowed
          Open

                      elseif ($ascii < 36)

          Inline control structures are not allowed
          Open

                          if (!isset($_sorted[$i]))

          Inline control structures are not allowed
          Open

                  if ($charCode > 35)

          Inline control structures are not allowed
          Open

                  else

          Inline control structures are not allowed
          Open

                  if ($charCode >= $this->_encoding)

          Inline control structures are not allowed
          Open

                  if ($ascii == 0) $ascii = 1;

          Inline control structures are not allowed
          Open

                      if ($this->_encoding > 62)

          Inline control structures are not allowed
          Open

                  if ($this->_specialChars) $parser->add('/;;;[^\\n\\r]+[\\n\\r]/');

          Inline control structures are not allowed
          Open

                  if (empty($script)) return $script;

          Inline control structures are not allowed
          Open

                  if (empty($arguments)) return '';

          Inline control structures are not allowed
          Open

                  if ($this->_specialChars)

          Inline control structures are not allowed
          Open

                  if ($this->_encoding)

          Inline control structures are not allowed
          Open

                      if ($count == 0)

          Inline control structures are not allowed
          Open

                  if (defined('self::JSFUNCTION'.$aName))

          Inline control structures are not allowed
          Open

                  else

          Inline control structures are not allowed
          Open

                  if (!empty($expression)) $this->_add($expression, $replacement, $length);

          Expected 1 space after ELSE keyword; newline found
          Open

                  else

          Line indented incorrectly; expected at least 4 spaces, found 0
          Open

          'function ($charCode) {

          Opening parenthesis of a multi-line function call must be the last content on the line
          Open

                  $parser->add('/((\\x24+)([a-zA-Z$_]+))(\\d*)/',

          Line indented incorrectly; expected at least 4 spaces, found 0
          Open

          'function ($charCode) {

          Opening parenthesis of a multi-line function call must be the last content on the line
          Open

                  $parser->add($regexp,

          Line indented incorrectly; expected at least 4 spaces, found 0
          Open

          'function ($packed, $ascii, $count, $keywords, $encode, $decode) {

          Opening parenthesis of a multi-line function call must be the last content on the line
          Open

                  $parser->add($regexp,

          Expected 1 space after ELSE keyword; newline found
          Open

                  else

          Line indented incorrectly; expected at least 4 spaces, found 0
          Open

          'function ($charCode) {

          Multi-line function call not indented correctly; expected 12 spaces but found 21
          Open

                               array('fn' => '_replace_name')

          Line indented incorrectly; expected at least 4 spaces, found 0
          Open

          '    if (!\'\'.replace(/^/, String)) {

          Expected 1 space after closing parenthesis; found 9
          Open

                      && $this->_escaped[$this->buffer['i']] != '')

          Line indented incorrectly; expected at least 4 spaces, found 0
          Open

          'function ($charCode) {

          The variable $_protected is not named in camelCase.
          Open

              private function _analyze($script, $regexp, $encode)
              {
                  // analyse
                  // retreive all words in the script
                  $all = array();

          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 $_sorted is not named in camelCase.
          Open

              private function _analyze($script, $regexp, $encode)
              {
                  // analyse
                  // retreive all words in the script
                  $all = array();

          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 $_sorted is not named in camelCase.
          Open

              private function _analyze($script, $regexp, $encode)
              {
                  // analyse
                  // retreive all words in the script
                  $all = array();

          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 $_specialChars is not named in camelCase.
          Open

              public function __construct($_script, $_encoding = 62, $_fastDecode = true, $_specialChars = false)
              {
                  $this->_script = $_script . "\n";
                  if (array_key_exists($_encoding, $this->LITERAL_ENCODING))
                      $_encoding = $this->LITERAL_ENCODING[$_encoding];

          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 $_fastDecode is not named in camelCase.
          Open

              public function __construct($_script, $_encoding = 62, $_fastDecode = true, $_specialChars = false)
              {
                  $this->_script = $_script . "\n";
                  if (array_key_exists($_encoding, $this->LITERAL_ENCODING))
                      $_encoding = $this->LITERAL_ENCODING[$_encoding];

          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 $_encoding is not named in camelCase.
          Open

              public function __construct($_script, $_encoding = 62, $_fastDecode = true, $_specialChars = false)
              {
                  $this->_script = $_script . "\n";
                  if (array_key_exists($_encoding, $this->LITERAL_ENCODING))
                      $_encoding = $this->LITERAL_ENCODING[$_encoding];

          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 $_sorted is not named in camelCase.
          Open

              private function _analyze($script, $regexp, $encode)
              {
                  // analyse
                  // retreive all words in the script
                  $all = array();

          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 $ENCODE is not named in camelCase.
          Open

              private function _bootStrap($packed, $keywords)
              {
                  $ENCODE = $this->_safeRegExp('$encode\\($count\\)');
          
                  // $packed: the packed script

          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 $_encoding is not named in camelCase.
          Open

              public function __construct($_script, $_encoding = 62, $_fastDecode = true, $_specialChars = false)
              {
                  $this->_script = $_script . "\n";
                  if (array_key_exists($_encoding, $this->LITERAL_ENCODING))
                      $_encoding = $this->LITERAL_ENCODING[$_encoding];

          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 $ENCODE is not named in camelCase.
          Open

              private function _bootStrap($packed, $keywords)
              {
                  $ENCODE = $this->_safeRegExp('$encode\\($count\\)');
          
                  // $packed: the packed script

          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 $ENCODE is not named in camelCase.
          Open

              private function _bootStrap($packed, $keywords)
              {
                  $ENCODE = $this->_safeRegExp('$encode\\($count\\)');
          
                  // $packed: the packed script

          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 $_sorted is not named in camelCase.
          Open

              private function _analyze($script, $regexp, $encode)
              {
                  // analyse
                  // retreive all words in the script
                  $all = array();

          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 $_encoding is not named in camelCase.
          Open

              public function __construct($_script, $_encoding = 62, $_fastDecode = true, $_specialChars = false)
              {
                  $this->_script = $_script . "\n";
                  if (array_key_exists($_encoding, $this->LITERAL_ENCODING))
                      $_encoding = $this->LITERAL_ENCODING[$_encoding];

          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 $_script is not named in camelCase.
          Open

              public function __construct($_script, $_encoding = 62, $_fastDecode = true, $_specialChars = false)
              {
                  $this->_script = $_script . "\n";
                  if (array_key_exists($_encoding, $this->LITERAL_ENCODING))
                      $_encoding = $this->LITERAL_ENCODING[$_encoding];

          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 is not named in camelCase.
          Open

              private function _analyze($script, $regexp, $encode)
              {
                  // analyse
                  // retreive all words in the script
                  $all = array();

          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 $_encoding is not named in camelCase.
          Open

              public function __construct($_script, $_encoding = 62, $_fastDecode = true, $_specialChars = false)
              {
                  $this->_script = $_script . "\n";
                  if (array_key_exists($_encoding, $this->LITERAL_ENCODING))
                      $_encoding = $this->LITERAL_ENCODING[$_encoding];

          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 is not named in camelCase.
          Open

              private function _analyze($script, $regexp, $encode)
              {
                  // analyse
                  // retreive all words in the script
                  $all = array();

          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 is not named in camelCase.
          Open

              private function _analyze($script, $regexp, $encode)
              {
                  // analyse
                  // retreive all words in the script
                  $all = array();

          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 $_sorted is not named in camelCase.
          Open

              private function _analyze($script, $regexp, $encode)
              {
                  // analyse
                  // retreive all words in the script
                  $all = array();

          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 $_sorted is not named in camelCase.
          Open

              private function _analyze($script, $regexp, $encode)
              {
                  // analyse
                  // retreive all words in the script
                  $all = array();

          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 $_protected is not named in camelCase.
          Open

              private function _analyze($script, $regexp, $encode)
              {
                  // analyse
                  // retreive all words in the script
                  $all = array();

          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 $_protected is not named in camelCase.
          Open

              private function _analyze($script, $regexp, $encode)
              {
                  // analyse
                  // retreive all words in the script
                  $all = array();

          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 _addParser is not named in camelCase.
          Open

              private function _addParser($parser)
              {
                  $this->_parsers[] = $parser;
              }

          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 _insertFastEncode is not named in camelCase.
          Open

              private function _insertFastEncode($match)
              {
                  return '{$encode=' . $this->buffer . ';';
              }

          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 _unescape is not named in camelCase.
          Open

              private function _unescape($string, $escapeChar)
              {
                  if ($escapeChar) {
                      $regexp = '/'.'\\'.$escapeChar.'/';
                      $this->buffer = array('escapeChar'=> $escapeChar, 'i' => 0);

          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 _analyze is not named in camelCase.
          Open

              private function _analyze($script, $regexp, $encode)
              {
                  // analyse
                  // retreive all words in the script
                  $all = array();

          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 _encode62 is not named in camelCase.
          Open

              private function _encode62($charCode)
              {
                  $res = '';
                  if ($charCode >= $this->_encoding) {
                      $res = $this->_encode62((int) ($charCode / $this->_encoding));

          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 _sortWords is not named in camelCase.
          Open

              private function _sortWords($match1, $match2)
              {
                  return $this->_count[$match2] - $this->_count[$match1];
              }

          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 _getEncoder is not named in camelCase.
          Open

              private function _getEncoder($ascii)
              {
                  return $ascii > 10 ? $ascii > 36 ? $ascii > 62 ?
                         '_encode95' : '_encode62' : '_encode36' : '_encode10';
              }

          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 _replacement is not named in camelCase.
          Open

              private function _replacement($arguments)
              {
                  if (empty($arguments)) return '';
          
                  $i = 1; $j = 0;

          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 _encode10 is not named in camelCase.
          Open

              private function _encode10($charCode)
              {
                  return $charCode;
              }

          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 _escape is not named in camelCase.
          Open

              private function _escape($string, $escapeChar)
              {
                  if ($escapeChar) {
                      $this->buffer = $escapeChar;
          
          

          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 _pack is not named in camelCase.
          Open

              private function _pack($script)
              {
                  for ($i = 0; isset($this->_parsers[$i]); $i++) {
                      $script = call_user_func(array(&$this, $this->_parsers[$i]), $script);
                  }

          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 _bootStrap is not named in camelCase.
          Open

              private function _bootStrap($packed, $keywords)
              {
                  $ENCODE = $this->_safeRegExp('$encode\\($count\\)');
          
                  // $packed: the packed script

          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 _replace_encoded is not named in camelCase.
          Open

              private function _replace_encoded($match, $offset)
              {
                  return $this->buffer[$match[$offset]];
              }

          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 _basicCompression is not named in camelCase.
          Open

              private function _basicCompression($script)
              {
                  $parser = new ParseMaster();
                  // make safe
                  $parser->escapeChar = '\\';

          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 _encodeSpecialChars is not named in camelCase.
          Open

              private function _encodeSpecialChars($script)
              {
                  $parser = new ParseMaster();
                  // replace: $name -> n, $$name -> na
                  $parser->add('/((\\x24+)([a-zA-Z$_]+))(\\d*)/',

          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 _encodePrivate is not named in camelCase.
          Open

              private function _encodePrivate($charCode)
              {
                  return "_" . $charCode;
              }

          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 _escapeBis is not named in camelCase.
          Open

              private function _escapeBis($match)
              {
                  $this->_escaped[] = $match[1];
          
                  return $this->buffer;

          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 _internalEscape is not named in camelCase.
          Open

              private function _internalEscape($string)
              {
                  return preg_replace($this->ESCAPE, '', $string);
              }

          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 _escape is not named in camelCase.
          Open

              private function _escape($script)
              {
                  return preg_replace('/([\\\\\'])/', '\\\$1', $script);
              }

          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 _escape95 is not named in camelCase.
          Open

              private function _escape95($script)
              {
                  return preg_replace_callback(
                      '/[\\xa1-\\xff]/',
                      array(&$this, '_escape95Bis'),

          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 _encodeKeywords is not named in camelCase.
          Open

              private function _encodeKeywords($script)
              {
                  // escape high-ascii values already in the script (i.e. in strings)
                  if ($this->_encoding > 62)
                      $script = $this->_escape95($script);

          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 _safeRegExp is not named in camelCase.
          Open

              private function _safeRegExp($string)
              {
                  return '/'.preg_replace('/\$/', '\\\$', $string).'/';
              }

          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 _getJSFunction is not named in camelCase.
          Open

              private function _getJSFunction($aName)
              {
                  if (defined('self::JSFUNCTION'.$aName))
                      return constant('self::JSFUNCTION'.$aName);
                  else

          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 _encode36 is not named in camelCase.
          Open

              private function _encode36($charCode)
              {
                  return base_convert($charCode, 10, 36);
              }

          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 _insertFastDecode is not named in camelCase.
          Open

              private function _insertFastDecode($match)
              {
                  return '{' . $this->buffer . ';';
              }

          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 _encode95 is not named in camelCase.
          Open

              private function _encode95($charCode)
              {
                  $res = '';
                  if ($charCode >= $this->_encoding)
                      $res = $this->_encode95($charCode / $this->_encoding);

          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 _escape95Bis is not named in camelCase.
          Open

              private function _escape95Bis($match)
              {
                  return '\x'.((string) dechex(ord($match)));
              }

          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 _add is not named in camelCase.
          Open

              private function _add()
              {
                  $arguments = func_get_args();
                  $this->_patterns[] = $arguments;
              }

          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 _backReferences is not named in camelCase.
          Open

              private function _backReferences($match, $offset)
              {
                  $replacement = $this->buffer['replacement'];
                  $quote = $this->buffer['quote'];
                  $i = $this->buffer['length'];

          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 _replace_name is not named in camelCase.
          Open

              private function _replace_name($match, $offset)
              {
                  $length = strlen($match[$offset + 2]);
                  $start = $length - max($length - strlen($match[$offset + 3]), 0);
          
          

          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 _unescapeBis is not named in camelCase.
          Open

              private function _unescapeBis()
              {
                  if (isset($this->_escaped[$this->buffer['i']])
                      && $this->_escaped[$this->buffer['i']] != '')
                  {

          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