YetiForceCompany/YetiForceCRM

View on GitHub
include/fields/CurrencyField.php

Summary

Maintainability
D
2 days
Test Coverage
D
60%

Function formatCurrencyValue has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
Open

    private function formatCurrencyValue($value)
    {
        $currencyPattern = $this->currencyFormat;
        $curSeparator = $this->currencySeparator;
        $decSeparator = $this->decimalSeparator;
Severity: Minor
Found in include/fields/CurrencyField.php - About 6 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Method formatCurrencyValue has 110 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function formatCurrencyValue($value)
    {
        $currencyPattern = $this->currencyFormat;
        $curSeparator = $this->currencySeparator;
        $decSeparator = $this->decimalSeparator;
Severity: Major
Found in include/fields/CurrencyField.php - About 4 hrs to fix

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

    class CurrencyField
    {
        private $CURRENCY_PATTERN_PLAIN = '123456789';
        private $CURRENCY_PATTERN_SINGLE_GROUPING = '123456,789';
        private $CURRENCY_PATTERN_THOUSAND_GROUPING = '123,456,789';
    Severity: Minor
    Found in include/fields/CurrencyField.php by phpmd

    File CurrencyField.php has 300 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /* +**********************************************************************************
     * The contents of this file are subject to the vtiger CRM Public License Version 1.0
     * ("License"); You may not use this file except in compliance with the License
     * The Original Code is:  vtiger CRM Open Source
    Severity: Minor
    Found in include/fields/CurrencyField.php - About 3 hrs to fix

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

          public function currencyDecimalFormat($value, $user = null)
          {
              if (!$user) {
                  $user = \App\User::getCurrentUserModel();
              }
      Severity: Minor
      Found in include/fields/CurrencyField.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

      Avoid too many return statements within this method.
      Open

              return $value;
      Severity: Major
      Found in include/fields/CurrencyField.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return $value;
        Severity: Major
        Found in include/fields/CurrencyField.php - About 30 mins to fix

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

              private function formatCurrencyValue($value)
              {
                  $currencyPattern = $this->currencyFormat;
                  $curSeparator = $this->currencySeparator;
                  $decSeparator = $this->decimalSeparator;
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          The method formatCurrencyValue() has an NPath complexity of 474320. The configured NPath complexity threshold is 200.
          Open

              private function formatCurrencyValue($value)
              {
                  $currencyPattern = $this->currencyFormat;
                  $curSeparator = $this->currencySeparator;
                  $decSeparator = $this->decimalSeparator;
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          NPathComplexity

          Since: 0.1

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

          Example

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

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

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

              private function formatCurrencyValue($value)
              {
                  $currencyPattern = $this->currencyFormat;
                  $curSeparator = $this->currencySeparator;
                  $decSeparator = $this->decimalSeparator;
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          CyclomaticComplexity

          Since: 0.1

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

          Example

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

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

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

              public function currencyDecimalFormat($value, $user = null)
              {
                  if (!$user) {
                      $user = \App\User::getCurrentUserModel();
                  }
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          CyclomaticComplexity

          Since: 0.1

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

          Example

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

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

          This function "formatCurrencyValue" has 151 lines, which is greater than the 150 lines authorized. Split it into smaller functions.
          Open

              private function formatCurrencyValue($value)
          Severity: Major
          Found in include/fields/CurrencyField.php by sonar-php

          A function that grows too large tends to aggregate too many responsibilities.

          Such functions inevitably become harder to understand and therefore harder to maintain.

          Above a specific threshold, it is strongly advised to refactor into smaller functions which focus on well-defined tasks.

          Those smaller functions will not only be easier to understand, but also probably easier to test.

          Reduce the number of returns of this function 5, down to the maximum allowed 3.
          Open

              public function currencyDecimalFormat($value, $user = null)
          Severity: Major
          Found in include/fields/CurrencyField.php by sonar-php

          Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.

          Noncompliant Code Example

          With the default threshold of 3:

          function myFunction(){ // Noncompliant as there are 4 return statements
            if (condition1) {
              return true;
            } else {
              if (condition2) {
                return false;
              } else {
                return true;
              }
            }
            return false;
          }
          

          Reduce the number of returns of this function 5, down to the maximum allowed 3.
          Open

              private function formatCurrencyValue($value)
          Severity: Major
          Found in include/fields/CurrencyField.php by sonar-php

          Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.

          Noncompliant Code Example

          With the default threshold of 3:

          function myFunction(){ // Noncompliant as there are 4 return statements
            if (condition1) {
              return true;
            } else {
              if (condition2) {
                return false;
              } else {
                return true;
              }
            }
            return false;
          }
          

          Refactor this function to reduce its Cognitive Complexity from 44 to the 15 allowed.
          Open

              private function formatCurrencyValue($value)
          Severity: Critical
          Found in include/fields/CurrencyField.php by sonar-php

          Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

          See

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

              public static function convertToUserFormatSymbol($value, $skipConversion = false, $currencySymbol = false, $skipFormatting = false)
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          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

          Missing class import via use statement (line '457', column '14').
          Open

                  $id = (new \App\Db\Query())->select(['id'])->from('vtiger_currency_info')->where(['<', 'defaultid', 0])->scalar();
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          MissingImport

          Since: 2.7.0

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

          Example

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

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

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

              public function getDisplayValue($user = null, $skipConversion = false, $skipFormatting = false)
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

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

              public function getDBInsertedValue($user = null, $skipConversion = false)
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

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

              public static function convertToUserFormatSymbol($value, $skipConversion = false, $currencySymbol = false, $skipFormatting = false)
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

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

              public static function convertToDBFormat($value, $user = null, $skipConversion = false)
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

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

              public function getDisplayValueWithSymbol($user = null, $skipConversion = false)
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

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

              public static function convertToUserFormat($value, $user = null, $skipConversion = false, $skipFormatting = false)
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

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

              public static function convertToUserFormat($value, $user = null, $skipConversion = false, $skipFormatting = false)
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

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

              public function getDisplayValue($user = null, $skipConversion = false, $skipFormatting = false)
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

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

              public static function convertToUserFormatSymbol($value, $skipConversion = false, $currencySymbol = false, $skipFormatting = false)
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

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

                          } else {
                              $wholeNumberFirstPart = 0;
                          }
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          ElseExpression

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class '\App\Fields\Double' in method 'currencyDecimalFormat'.
          Open

                          $value = \App\Fields\Double::truncateZeros($value);
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class '\App\Fields\Currency' in method 'initialize'.
          Open

                  $currencyData = \App\Fields\Currency::getById($this->currencyId);
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

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

                      } else {
                          $numericParts[0] = $wholeNumberLastPart;
                      }
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          ElseExpression

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class '\App\User' in method 'getDisplayValue'.
          Open

                      $user = \App\User::getCurrentUserModel();
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class '\App\User' in method 'currencyDecimalFormat'.
          Open

                      $user = \App\User::getCurrentUserModel();
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class '\App\User' in method 'initialize'.
          Open

                      $user = \App\User::getCurrentUserModel();
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

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

                  } else {
                      $sign = '';
                  }
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          ElseExpression

          Since: 1.4.0

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

          Example

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

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

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

                      } else {
                          $numericParts[0] = $wholeNumberLastPart;
                      }
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          ElseExpression

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class 'App\Config' in method 'initialize'.
          Open

                  $defaultCharset = App\Config::main('default_charset');
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class 'App\Purifier' in method 'currencyDecimalFormat'.
          Open

                      $fieldValue = explode(App\Purifier::decodeHtml($decSeparator), $value);
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class '\App\User' in method 'getDBInsertedValue'.
          Open

                      $user = \App\User::getCurrentUserModel();
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

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

                  } else {
                      $this->currencyId = self::getDBCurrencyId();
                  }
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          ElseExpression

          Since: 1.4.0

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

          Example

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

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

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

                      } else {
                          $numericParts[0] = 0;
                      }
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          ElseExpression

          Since: 1.4.0

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

          Example

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

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

          Define a constant instead of duplicating this literal "currency_decimal_separator" 3 times.
          Open

                      $this->decimalSeparator = str_replace("\xC2\xA0", ' ', html_entity_decode($user->getDetail('currency_decimal_separator'), ENT_QUOTES, $defaultCharset));
          Severity: Critical
          Found in include/fields/CurrencyField.php by sonar-php

          Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

          On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

          Noncompliant Code Example

          With the default threshold of 3:

          function run() {
            prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
            execute('action1');
            release('action1');
          }
          

          Compliant Solution

          ACTION_1 = 'action1';
          
          function run() {
            prepare(ACTION_1);
            execute(ACTION_1);
            release(ACTION_1);
          }
          

          Exceptions

          To prevent generating some false-positives, literals having less than 5 characters are excluded.

          Define a constant instead of duplicating this literal "no_of_currency_decimals" 3 times.
          Open

                  $this->numberOfDecimal = (empty($user->getDetail('no_of_currency_decimals')) && 0 !== (int) $user->getDetail('no_of_currency_decimals')) ? 2 : (int) $user->getDetail('no_of_currency_decimals');
          Severity: Critical
          Found in include/fields/CurrencyField.php by sonar-php

          Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

          On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

          Noncompliant Code Example

          With the default threshold of 3:

          function run() {
            prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
            execute('action1');
            release('action1');
          }
          

          Compliant Solution

          ACTION_1 = 'action1';
          
          function run() {
            prepare(ACTION_1);
            execute(ACTION_1);
            release(ACTION_1);
          }
          

          Exceptions

          To prevent generating some false-positives, literals having less than 5 characters are excluded.

          Argument 1 (value) is false|float|int|string but \CurrencyField::__construct() takes \Number defined at /code/include/fields/CurrencyField.php:92
          Open

                  $self = new self($value);
          Severity: Minor
          Found in include/fields/CurrencyField.php by phan

          Parameter $user has undeclared type \App\User (Did you mean class \Tests\App\User)
          Open

              public function getDisplayValue($user = null, $skipConversion = false, $skipFormatting = false)
          Severity: Minor
          Found in include/fields/CurrencyField.php by phan

          Argument 1 (currencyValue) is string but \CurrencyField::appendCurrencySymbol() takes \Number defined at /code/include/fields/CurrencyField.php:225
          Open

                  return self::appendCurrencySymbol($formattedValue, $this->currencySymbol, $this->currencySymbolPlacement);
          Severity: Minor
          Found in include/fields/CurrencyField.php by phan

          Call to method getDetail from undeclared class \App\User (Did you mean class \Tests\App\User)
          Open

                      $this->decimalSeparator = str_replace("\xC2\xA0", ' ', html_entity_decode($user->getDetail('currency_decimal_separator'), ENT_QUOTES, $defaultCharset));
          Severity: Critical
          Found in include/fields/CurrencyField.php by phan

          Call to method getCurrentUserModel from undeclared class \App\User (Did you mean class \Tests\App\User)
          Open

                      $currencySymbolPlacement = \App\User::getCurrentUserModel()->getDetail('currency_symbol_placement');
          Severity: Critical
          Found in include/fields/CurrencyField.php by phan

          Parameter $value has undeclared type \Number
          Open

              private function formatCurrencyValue($value)
          Severity: Minor
          Found in include/fields/CurrencyField.php by phan

          Returning type 0 but convertToDBFormat() is declared to return \Number
          Open

                      return 0;
          Severity: Minor
          Found in include/fields/CurrencyField.php by phan

          Saw unextractable annotation for comment '* @var <type>'</type>
          Open

               * @var <type>
          Severity: Info
          Found in include/fields/CurrencyField.php by phan

          Property \CurrencyField->conversionRate has undeclared type \Number
          Open

              public $conversionRate = 1;
          Severity: Minor
          Found in include/fields/CurrencyField.php by phan

          Returning type 0|float but getDBInsertedValue() is declared to return \Number
          Open

                  return $dbValue;
          Severity: Minor
          Found in include/fields/CurrencyField.php by phan

          Call to method getDetail from undeclared class \App\User (Did you mean class \Tests\App\User)
          Open

                  if (!empty($user->getDetail('currency_id'))) {
          Severity: Critical
          Found in include/fields/CurrencyField.php by phan

          Returning type float but getDBInsertedValue() is declared to return \Number
          Open

                  return $dbValue;
          Severity: Minor
          Found in include/fields/CurrencyField.php by phan

          Return type of convertToDBFormat() is undeclared type \Number
          Open

              public static function convertToDBFormat($value, $user = null, $skipConversion = false)
          Severity: Minor
          Found in include/fields/CurrencyField.php by phan

          Parameter $user has undeclared type \App\User (Did you mean class \Tests\App\User)
          Open

              public function initialize($user = null)
          Severity: Minor
          Found in include/fields/CurrencyField.php by phan

          Parameter $user has undeclared type \App\User (Did you mean class \Tests\App\User)
          Open

              public static function convertToDBFormat($value, $user = null, $skipConversion = false)
          Severity: Minor
          Found in include/fields/CurrencyField.php by phan

          The phpdoc comment for @param cannot occur on a property
          Open

               * @param Number $value
          Severity: Info
          Found in include/fields/CurrencyField.php by phan

          Call to method getCurrentUserModel from undeclared class \App\User (Did you mean class \Tests\App\User)
          Open

                      $user = \App\User::getCurrentUserModel();
          Severity: Critical
          Found in include/fields/CurrencyField.php by phan

          Assigning int to property but \CurrencyField->conversionRate is \Number
          Open

              public $conversionRate = 1;
          Severity: Minor
          Found in include/fields/CurrencyField.php by phan

          Argument 1 (str) is float|int but \substr() takes string
          Open

                      $value = substr($value, 1);
          Severity: Minor
          Found in include/fields/CurrencyField.php by phan

          Argument 1 (currencyValue) is string but \CurrencyField::appendCurrencySymbol() takes \Number defined at /code/include/fields/CurrencyField.php:225
          Open

                  $value = self::appendCurrencySymbol($formattedValue, $currencySymbol, $self->currencySymbolPlacement);
          Severity: Minor
          Found in include/fields/CurrencyField.php by phan

          Assigning int to property but \CurrencyField->maxNumberOfDecimals is \Number
          Open

              public $maxNumberOfDecimals = 5;
          Severity: Minor
          Found in include/fields/CurrencyField.php by phan

          Expected @param annotation for value to be before the @param annotation for user
          Open

               * @param \App\User $user
          Severity: Info
          Found in include/fields/CurrencyField.php by phan

          Argument 1 (user) is null but \CurrencyField::getDisplayValue() takes \App\User defined at /code/include/fields/CurrencyField.php:183
          Open

                  $formattedValue = $self->getDisplayValue(null, $skipConversion, $skipFormatting);
          Severity: Minor
          Found in include/fields/CurrencyField.php by phan

          Parameter $user has undeclared type \App\User (Did you mean class \Tests\App\User)
          Open

              public function getDisplayValueWithSymbol($user = null, $skipConversion = false)
          Severity: Minor
          Found in include/fields/CurrencyField.php by phan

          Return type of getDBInsertedValue() is undeclared type \Number
          Open

              public function getDBInsertedValue($user = null, $skipConversion = false)
          Severity: Minor
          Found in include/fields/CurrencyField.php by phan

          Argument 1 (haystack) is float|int but \stripos() takes string
          Open

                  if (0 === stripos($value, '-')) {
          Severity: Minor
          Found in include/fields/CurrencyField.php by phan

          Call to method getDetail from undeclared class \App\User (Did you mean class \Tests\App\User)
          Open

                  $this->numberOfDecimal = (empty($user->getDetail('no_of_currency_decimals')) && 0 !== (int) $user->getDetail('no_of_currency_decimals')) ? 2 : (int) $user->getDetail('no_of_currency_decimals');
          Severity: Critical
          Found in include/fields/CurrencyField.php by phan

          Parameter $user has undeclared type \App\User (Did you mean class \Tests\App\User)
          Open

              public static function convertToUserFormat($value, $user = null, $skipConversion = false, $skipFormatting = false)
          Severity: Minor
          Found in include/fields/CurrencyField.php by phan

          Parameter $currencyValue has undeclared type \Number
          Open

              public static function appendCurrencySymbol($currencyValue, $currencySymbol, $currencySymbolPlacement = '')
          Severity: Minor
          Found in include/fields/CurrencyField.php by phan

          Property \CurrencyField->maxNumberOfDecimals has undeclared type \Number
          Open

              public $maxNumberOfDecimals = 5;
          Severity: Minor
          Found in include/fields/CurrencyField.php by phan

          Argument 1 (value) is false|string but \CurrencyField::__construct() takes \Number defined at /code/include/fields/CurrencyField.php:92
          Open

                  $self = new self($value);
          Severity: Minor
          Found in include/fields/CurrencyField.php by phan

          Parameter $value has undeclared type \Number
          Open

              public static function convertToDBFormat($value, $user = null, $skipConversion = false)
          Severity: Minor
          Found in include/fields/CurrencyField.php by phan

          Call to method getDetail from undeclared class \App\User (Did you mean class \Tests\App\User)
          Open

                      $this->currencyFormat = html_entity_decode($user->getDetail('currency_grouping_pattern'), ENT_QUOTES, $defaultCharset);
          Severity: Critical
          Found in include/fields/CurrencyField.php by phan

          Call to method getDetail from undeclared class \App\User (Did you mean class \Tests\App\User)
          Open

                      $this->currencySeparator = str_replace("\xC2\xA0", ' ', html_entity_decode($user->getDetail('currency_grouping_separator'), ENT_QUOTES, $defaultCharset));
          Severity: Critical
          Found in include/fields/CurrencyField.php by phan

          Call to method getCurrentUserModel from undeclared class \App\User (Did you mean class \Tests\App\User)
          Open

                      $user = \App\User::getCurrentUserModel();
          Severity: Critical
          Found in include/fields/CurrencyField.php by phan

          Call to undeclared method \App\Db\Query::select
          Open

                  $id = (new \App\Db\Query())->select(['id'])->from('vtiger_currency_info')->where(['<', 'defaultid', 0])->scalar();
          Severity: Critical
          Found in include/fields/CurrencyField.php by phan

          Returning type null but getDBCurrencyId() is declared to return int
          Open

                  return null;
          Severity: Minor
          Found in include/fields/CurrencyField.php by phan

          Call to method getDetail from undeclared class \App\User (Did you mean class \Tests\App\User)
          Open

                  $this->currencySymbolPlacement = $user->getDetail('currency_symbol_placement');
          Severity: Critical
          Found in include/fields/CurrencyField.php by phan

          Suspicious type \Number of a variable or expression used to build a string. (Expected type to be able to cast to a string)
          Open

                          $returnValue = $currencyValue . ' ' . $currencySymbol;
          Severity: Minor
          Found in include/fields/CurrencyField.php by phan

          Suspicious type \Number of a variable or expression used to build a string. (Expected type to be able to cast to a string)
          Open

                          $returnValue = html_entity_decode($currencySymbol, ENT_COMPAT) . ' ' . $currencyValue;
          Severity: Minor
          Found in include/fields/CurrencyField.php by phan

          Call to method getCurrentUserModel from undeclared class \App\User (Did you mean class \Tests\App\User)
          Open

                      $user = \App\User::getCurrentUserModel();
          Severity: Critical
          Found in include/fields/CurrencyField.php by phan

          Argument 3 (subject) is \Number but \str_replace() takes array|string
          Open

                  $dbValue = str_replace($curSeparator, '', $this->value);
          Severity: Minor
          Found in include/fields/CurrencyField.php by phan

          Call to method getDetail from undeclared class \App\User (Did you mean class \Tests\App\User)
          Open

                  if (!empty($user->getDetail('currency_grouping_pattern'))) {
          Severity: Critical
          Found in include/fields/CurrencyField.php by phan

          Call to method getDetail from undeclared class \App\User (Did you mean class \Tests\App\User)
          Open

                      $this->currencyId = $user->getDetail('currency_id');
          Severity: Critical
          Found in include/fields/CurrencyField.php by phan

          Parameter $user has undeclared type \App\User (Did you mean class \Tests\App\User)
          Open

              public function getDBInsertedValue($user = null, $skipConversion = false)
          Severity: Minor
          Found in include/fields/CurrencyField.php by phan

          Parameter $value has undeclared type \Number
          Open

              public function __construct($value)
          Severity: Minor
          Found in include/fields/CurrencyField.php by phan

          Argument 1 (number) is \Number but \number_format() takes float|int
          Open

                  $value = number_format($value, $currencyDecimalPlaces, '.', '');
          Severity: Minor
          Found in include/fields/CurrencyField.php by phan

          Call to method getCurrentUserModel from undeclared class \App\User (Did you mean class \Tests\App\User)
          Open

                      $user = \App\User::getCurrentUserModel();
          Severity: Critical
          Found in include/fields/CurrencyField.php by phan

          Avoid excessively long variable names like $currencySymbolPlacement. Keep variable name length under 20.
          Open

              public $currencySymbolPlacement;
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          LongVariable

          Since: 0.2

          Detects when a field, formal or local variable is declared with a long name.

          Example

          class Something {
              protected $reallyLongIntName = -3; // VIOLATION - Field
              public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                  $otherReallyLongName = -5; // VIOLATION - Local
                  for ($interestingIntIndex = 0; // VIOLATION - For
                       $interestingIntIndex < 10;
                       $interestingIntIndex++ ) {
                  }
              }
          }

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

          Avoid excessively long variable names like $CURRENCY_PATTERN_PLAIN. Keep variable name length under 20.
          Open

              private $CURRENCY_PATTERN_PLAIN = '123456789';
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          LongVariable

          Since: 0.2

          Detects when a field, formal or local variable is declared with a long name.

          Example

          class Something {
              protected $reallyLongIntName = -3; // VIOLATION - Field
              public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                  $otherReallyLongName = -5; // VIOLATION - Local
                  for ($interestingIntIndex = 0; // VIOLATION - For
                       $interestingIntIndex < 10;
                       $interestingIntIndex++ ) {
                  }
              }
          }

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

          Avoid excessively long variable names like $wholeNumberFirstPartElements. Keep variable name length under 20.
          Open

                          $wholeNumberFirstPartElements = str_split($wholeNumberFirstPart, 2);
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          LongVariable

          Since: 0.2

          Detects when a field, formal or local variable is declared with a long name.

          Example

          class Something {
              protected $reallyLongIntName = -3; // VIOLATION - Field
              public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                  $otherReallyLongName = -5; // VIOLATION - Local
                  for ($interestingIntIndex = 0; // VIOLATION - For
                       $interestingIntIndex < 10;
                       $interestingIntIndex++ ) {
                  }
              }
          }

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

          Avoid excessively long variable names like $CURRENCY_PATTERN_MIXED_GROUPING. Keep variable name length under 20.
          Open

              private $CURRENCY_PATTERN_MIXED_GROUPING = '12,34,56,789';
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          LongVariable

          Since: 0.2

          Detects when a field, formal or local variable is declared with a long name.

          Example

          class Something {
              protected $reallyLongIntName = -3; // VIOLATION - Field
              public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                  $otherReallyLongName = -5; // VIOLATION - Local
                  for ($interestingIntIndex = 0; // VIOLATION - For
                       $interestingIntIndex < 10;
                       $interestingIntIndex++ ) {
                  }
              }
          }

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

          Avoid excessively long variable names like $currencySymbolPlacement. Keep variable name length under 20.
          Open

              public static function appendCurrencySymbol($currencyValue, $currencySymbol, $currencySymbolPlacement = '')
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          LongVariable

          Since: 0.2

          Detects when a field, formal or local variable is declared with a long name.

          Example

          class Something {
              protected $reallyLongIntName = -3; // VIOLATION - Field
              public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                  $otherReallyLongName = -5; // VIOLATION - Local
                  for ($interestingIntIndex = 0; // VIOLATION - For
                       $interestingIntIndex < 10;
                       $interestingIntIndex++ ) {
                  }
              }
          }

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

          Avoid excessively long variable names like $currencyDecimalPlaces. Keep variable name length under 20.
          Open

                  $currencyDecimalPlaces = $this->numberOfDecimal;
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          LongVariable

          Since: 0.2

          Detects when a field, formal or local variable is declared with a long name.

          Example

          class Something {
              protected $reallyLongIntName = -3; // VIOLATION - Field
              public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                  $otherReallyLongName = -5; // VIOLATION - Local
                  for ($interestingIntIndex = 0; // VIOLATION - For
                       $interestingIntIndex < 10;
                       $interestingIntIndex++ ) {
                  }
              }
          }

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

          Avoid excessively long variable names like $CURRENCY_PATTERN_SINGLE_GROUPING. Keep variable name length under 20.
          Open

              private $CURRENCY_PATTERN_SINGLE_GROUPING = '123456,789';
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          LongVariable

          Since: 0.2

          Detects when a field, formal or local variable is declared with a long name.

          Example

          class Something {
              protected $reallyLongIntName = -3; // VIOLATION - Field
              public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                  $otherReallyLongName = -5; // VIOLATION - Local
                  for ($interestingIntIndex = 0; // VIOLATION - For
                       $interestingIntIndex < 10;
                       $interestingIntIndex++ ) {
                  }
              }
          }

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

          Avoid excessively long variable names like $CURRENCY_PATTERN_THOUSAND_GROUPING. Keep variable name length under 20.
          Open

              private $CURRENCY_PATTERN_THOUSAND_GROUPING = '123,456,789';
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          LongVariable

          Since: 0.2

          Detects when a field, formal or local variable is declared with a long name.

          Example

          class Something {
              protected $reallyLongIntName = -3; // VIOLATION - Field
              public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                  $otherReallyLongName = -5; // VIOLATION - Local
                  for ($interestingIntIndex = 0; // VIOLATION - For
                       $interestingIntIndex < 10;
                       $interestingIntIndex++ ) {
                  }
              }
          }

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

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

          class CurrencyField

          The property $CURRENCY_PATTERN_MIXED_GROUPING is not named in camelCase.
          Open

          class CurrencyField
          {
              private $CURRENCY_PATTERN_PLAIN = '123456789';
              private $CURRENCY_PATTERN_SINGLE_GROUPING = '123456,789';
              private $CURRENCY_PATTERN_THOUSAND_GROUPING = '123,456,789';
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

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

          class CurrencyField
          {
              private $CURRENCY_PATTERN_PLAIN = '123456789';
              private $CURRENCY_PATTERN_SINGLE_GROUPING = '123456,789';
              private $CURRENCY_PATTERN_THOUSAND_GROUPING = '123,456,789';
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

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

          class CurrencyField
          {
              private $CURRENCY_PATTERN_PLAIN = '123456789';
              private $CURRENCY_PATTERN_SINGLE_GROUPING = '123456,789';
              private $CURRENCY_PATTERN_THOUSAND_GROUPING = '123,456,789';
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

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

          class CurrencyField
          {
              private $CURRENCY_PATTERN_PLAIN = '123456789';
              private $CURRENCY_PATTERN_SINGLE_GROUPING = '123456,789';
              private $CURRENCY_PATTERN_THOUSAND_GROUPING = '123,456,789';
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          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 $id. Configured minimum length is 3.
          Open

                  $id = (new \App\Db\Query())->select(['id'])->from('vtiger_currency_info')->where(['<', 'defaultid', 0])->scalar();
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          ShortVariable

          Since: 0.2

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

          Example

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

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

          Spaces must be used for alignment; tabs are not allowed
          Open

              public static function convertToUserFormat($value, $user = null, $skipConversion = false, $skipFormatting = false)

          Spaces must be used for alignment; tabs are not allowed
          Open

                  if (0 === stripos($value, '-')) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $value = substr($value, 1);

          Spaces must be used for alignment; tabs are not allowed
          Open

                  $value = $self->getDisplayValue($user, $skipConversion, $skipFormatting);

          Spaces must be used for alignment; tabs are not allowed
          Open

                  if (false === $skipConversion) {

          Spaces must be used for alignment; tabs are not allowed
          Open

               * Function that converts the Number into Users Currency along with currency symbol.

          Spaces must be used for alignment; tabs are not allowed
          Open

              /**

          Spaces must be used for alignment; tabs are not allowed
          Open

               * @param Number $currencyValue

          Spaces must be used for alignment; tabs are not allowed
          Open

               * @return bool|string Formatted Currency

          Spaces must be used for alignment; tabs are not allowed
          Open

               */

          Spaces must be used for alignment; tabs are not allowed
          Open

               * Function that converts the Number into Users Currency.

          Spaces must be used for alignment; tabs are not allowed
          Open

               *

          Spaces must be used for alignment; tabs are not allowed
          Open

                  }

          Spaces must be used for alignment; tabs are not allowed
          Open

               *

          Spaces must be used for alignment; tabs are not allowed
          Open

              {

          Spaces must be used for alignment; tabs are not allowed
          Open

                  $negative = false;

          Spaces must be used for alignment; tabs are not allowed
          Open

                  $value = self::appendCurrencySymbol($formattedValue, $currencySymbol, $self->currencySymbolPlacement);

          Spaces must be used for alignment; tabs are not allowed
          Open

               * @param bool      $skipConversion

          Spaces must be used for alignment; tabs are not allowed
          Open

               */

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $displayValue = $this->formatCurrencyValue($displayValue);

          Spaces must be used for alignment; tabs are not allowed
          Open

              }

          Spaces must be used for alignment; tabs are not allowed
          Open

               * Static Function that appends the currency symbol to a given currency value, based on the preferred symbol placement.

          Spaces must be used for alignment; tabs are not allowed
          Open

                      case '1.0$':

          Spaces must be used for alignment; tabs are not allowed
          Open

                  }

          Spaces must be used for alignment; tabs are not allowed
          Open

                  $self = new self($value);

          Spaces must be used for alignment; tabs are not allowed
          Open

                  // To support negative values

          Spaces must be used for alignment; tabs are not allowed
          Open

              {

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $negative = true;

          Spaces must be used for alignment; tabs are not allowed
          Open

                  if (empty($user)) {

          Spaces must be used for alignment; tabs are not allowed
          Open

               * @return string Formatted Currency

          Spaces must be used for alignment; tabs are not allowed
          Open

              public static function appendCurrencySymbol($currencyValue, $currencySymbol, $currencySymbolPlacement = '')

          Spaces must be used for alignment; tabs are not allowed
          Open

                  }

          Spaces must be used for alignment; tabs are not allowed
          Open

               * @param string $currencySymbol

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $currencySymbolPlacement = \App\User::getCurrentUserModel()->getDetail('currency_symbol_placement');

          Spaces must be used for alignment; tabs are not allowed
          Open

                  switch ($currencySymbolPlacement) {

          Spaces must be used for alignment; tabs are not allowed
          Open

               * @deprecated        Recommend using function \App\Fields\Currency::formatToDisplay

          Spaces must be used for alignment; tabs are not allowed
          Open

                  if (0 === stripos($value, '-')) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $value = substr($value, 1);

          Spaces must be used for alignment; tabs are not allowed
          Open

                  $formattedValue = $self->getDisplayValue(null, $skipConversion, $skipFormatting);

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $user = \App\User::getCurrentUserModel();

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $displayValue = 0;

          Spaces must be used for alignment; tabs are not allowed
          Open

               */

          Spaces must be used for alignment; tabs are not allowed
          Open

                          $returnValue = $currencyValue . ' ' . $currencySymbol;

          Spaces must be used for alignment; tabs are not allowed
          Open

              {

          Spaces must be used for alignment; tabs are not allowed
          Open

               * @param mixed     $skipFormatting

          Spaces must be used for alignment; tabs are not allowed
          Open

              {

          Spaces must be used for alignment; tabs are not allowed
          Open

               */

          Spaces must be used for alignment; tabs are not allowed
          Open

               * @param string $currencySymbolPlacement

          Spaces must be used for alignment; tabs are not allowed
          Open

               * @return string Formatted Currency

          Spaces must be used for alignment; tabs are not allowed
          Open

                  $self = new self($value);

          Spaces must be used for alignment; tabs are not allowed
          Open

                  }

          Spaces must be used for alignment; tabs are not allowed
          Open

                  return ($negative) ? '-' . $value : $value;

          Spaces must be used for alignment; tabs are not allowed
          Open

               *

          Spaces must be used for alignment; tabs are not allowed
          Open

                  if (empty($displayValue)) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $displayValue = self::convertFromDollar($displayValue, $this->conversionRate);

          Spaces must be used for alignment; tabs are not allowed
          Open

              /**

          Spaces must be used for alignment; tabs are not allowed
          Open

               *

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $negative = true;

          Spaces must be used for alignment; tabs are not allowed
          Open

              public static function convertToUserFormatSymbol($value, $skipConversion = false, $currencySymbol = false, $skipFormatting = false)

          Spaces must be used for alignment; tabs are not allowed
          Open

               * @param \App\User $user

          Spaces must be used for alignment; tabs are not allowed
          Open

               * @return string Formatted Currency

          Spaces must be used for alignment; tabs are not allowed
          Open

                  }

          Spaces must be used for alignment; tabs are not allowed
          Open

                  }

          Spaces must be used for alignment; tabs are not allowed
          Open

                  if (false === $skipFormatting) {

          Spaces must be used for alignment; tabs are not allowed
          Open

              public function getDisplayValueWithSymbol($user = null, $skipConversion = false)

          Spaces must be used for alignment; tabs are not allowed
          Open

               *

          Spaces must be used for alignment; tabs are not allowed
          Open

              {

          Spaces must be used for alignment; tabs are not allowed
          Open

                  return self::appendCurrencySymbol($formattedValue, $this->currencySymbol, $this->currencySymbolPlacement);

          Spaces must be used for alignment; tabs are not allowed
          Open

              }

          Spaces must be used for alignment; tabs are not allowed
          Open

               * Function that formats the Number based on the User configured Pattern, Currency separator and Decimal separator.

          Spaces must be used for alignment; tabs are not allowed
          Open

                  }

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $currencySymbol = $self->currencySymbol;

          Spaces must be used for alignment; tabs are not allowed
          Open

              }

          Spaces must be used for alignment; tabs are not allowed
          Open

               *

          Spaces must be used for alignment; tabs are not allowed
          Open

                  if (!$currencySymbolPlacement) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                      case '$1.0':

          Spaces must be used for alignment; tabs are not allowed
          Open

              }

          Spaces must be used for alignment; tabs are not allowed
          Open

               */

          Spaces must be used for alignment; tabs are not allowed
          Open

              private function formatCurrencyValue($value)

          Spaces must be used for alignment; tabs are not allowed
          Open

                  $currencyPattern = $this->currencyFormat;

          Spaces must be used for alignment; tabs are not allowed
          Open

                  }

          Spaces must be used for alignment; tabs are not allowed
          Open

                  // To support negative values

          Spaces must be used for alignment; tabs are not allowed
          Open

              public function getDisplayValue($user = null, $skipConversion = false, $skipFormatting = false)

          Spaces must be used for alignment; tabs are not allowed
          Open

               * @param bool      $skipConversion

          Spaces must be used for alignment; tabs are not allowed
          Open

                          $returnValue = html_entity_decode($currencySymbol, ENT_COMPAT) . ' ' . $currencyValue;

          Spaces must be used for alignment; tabs are not allowed
          Open

               *

          Spaces must be used for alignment; tabs are not allowed
          Open

               * @param Number $value

          Spaces must be used for alignment; tabs are not allowed
          Open

                  $negative = false;

          Spaces must be used for alignment; tabs are not allowed
          Open

                  if (false === $currencySymbol) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                  $this->initialize($user);

          Spaces must be used for alignment; tabs are not allowed
          Open

                          break;

          Spaces must be used for alignment; tabs are not allowed
          Open

               *

          Spaces must be used for alignment; tabs are not allowed
          Open

                  return ($negative) ? '-' . $value : $value;

          Spaces must be used for alignment; tabs are not allowed
          Open

              }

          Spaces must be used for alignment; tabs are not allowed
          Open

                  $displayValue = $this->value;

          Spaces must be used for alignment; tabs are not allowed
          Open

                  }

          Spaces must be used for alignment; tabs are not allowed
          Open

                  return $this->currencyDecimalFormat($displayValue, $user);

          Spaces must be used for alignment; tabs are not allowed
          Open

               * @return string Currency value appended with the currency symbol

          Spaces must be used for alignment; tabs are not allowed
          Open

              {

          Spaces must be used for alignment; tabs are not allowed
          Open

                  return $returnValue;

          Spaces must be used for alignment; tabs are not allowed
          Open

              /**

          Spaces must be used for alignment; tabs are not allowed
          Open

              /**

          Spaces must be used for alignment; tabs are not allowed
          Open

               * @param \App\User $user

          Spaces must be used for alignment; tabs are not allowed
          Open

               *

          Spaces must be used for alignment; tabs are not allowed
          Open

                  $formattedValue = $this->getDisplayValue($user, $skipConversion);

          Spaces must be used for alignment; tabs are not allowed
          Open

                      default:

          Spaces must be used for alignment; tabs are not allowed
          Open

                  $curSeparator = $this->currencySeparator;

          Spaces must be used for alignment; tabs are not allowed
          Open

                      if (\strlen($wholeNumber) > 3) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                      // Second Part of the number (last 3 digits) which should be separated from the First part using Currency Separator

          Spaces must be used for alignment; tabs are not allowed
          Open

                  if ($currencyPattern == $this->CURRENCY_PATTERN_THOUSAND_GROUPING) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $wholeNumber = $numericParts[0];

          Spaces must be used for alignment; tabs are not allowed
          Open

                      if ($wholeNumber < 0 || $negativeNumber) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                          $negativeNumber = true;

          Spaces must be used for alignment; tabs are not allowed
          Open

                      if ($wholeNumber < 0 || $negativeNumber) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                      // Second Part of the number (last 3 digits) which should be separated from the First part using Currency Separator

          Spaces must be used for alignment; tabs are not allowed
          Open

                          // Pad the rest of the length in the number string with Leading 0, to get it to the multiples of 2

          Spaces must be used for alignment; tabs are not allowed
          Open

                      //if its negative number, append-back the negative symbol to the whole number part

          Spaces must be used for alignment; tabs are not allowed
          Open

                          $numericParts[0] = '-' . $numericParts[0];

          Spaces must be used for alignment; tabs are not allowed
          Open

                      }

          Spaces must be used for alignment; tabs are not allowed
          Open

                      if (!empty($wholeNumberFirstPart)) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                      // Re-create the currency value combining the whole number and the decimal part using Decimal separator

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $negativeNumber = false;

          Spaces must be used for alignment; tabs are not allowed
          Open

                          $wholeNumberFirstPart = substr($wholeNumber, 0, \strlen($wholeNumber) - 3);

          Spaces must be used for alignment; tabs are not allowed
          Open

                              $wholeNumberFirstPart = ltrim($wholeNumberFirstPart, '0');

          Spaces must be used for alignment; tabs are not allowed
          Open

               *

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $sign = '';

          Spaces must be used for alignment; tabs are not allowed
          Open

                      // Re-create the whole number with user's configured currency separator

          Spaces must be used for alignment; tabs are not allowed
          Open

                          $negativeNumber = true;

          Spaces must be used for alignment; tabs are not allowed
          Open

                          $negativeNumber = true;

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $OddGroupLength = $numberLength % 3;

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $wholeNumber = $numericParts[0];

          Spaces must be used for alignment; tabs are not allowed
          Open

                          $wholeNumber = $positiveValues[1];

          Spaces must be used for alignment; tabs are not allowed
          Open

                  }

          Spaces must be used for alignment; tabs are not allowed
          Open

               * @param bool      $skipConversion

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $decSeparator = ' ';

          Spaces must be used for alignment; tabs are not allowed
          Open

                      return $sign . $number;

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $wholeNumber = $numericParts[0];

          Spaces must be used for alignment; tabs are not allowed
          Open

                          $wholeNumber = $positiveValues[1];

          Spaces must be used for alignment; tabs are not allowed
          Open

                      if ($OddGroupLength > 0) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                      // Split the whole number into chunks of 3 digits

          Spaces must be used for alignment; tabs are not allowed
          Open

                      // Re-create the whole number with user's configured currency separator

          Spaces must be used for alignment; tabs are not allowed
          Open

                          $numericParts[0] = ltrim($wholeNumber, '0');

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $number = implode($decSeparator, $numericParts);

          Spaces must be used for alignment; tabs are not allowed
          Open

                          $numberLength = \strlen($wholeNumberFirstPart);

          Spaces must be used for alignment; tabs are not allowed
          Open

                          }

          Spaces must be used for alignment; tabs are not allowed
          Open

                          // Re-create the whole number with user's configured currency separator

          Spaces must be used for alignment; tabs are not allowed
          Open

               * @return Number

          Spaces must be used for alignment; tabs are not allowed
          Open

                      // Re-create the currency value combining the whole number and the decimal part using Decimal separator

          Spaces must be used for alignment; tabs are not allowed
          Open

                      // Separate the numeric and decimal parts

          Spaces must be used for alignment; tabs are not allowed
          Open

                          $gapsToBeFilled = 0;

          Spaces must be used for alignment; tabs are not allowed
          Open

                          $wholeNumberFirstPart = implode($curSeparator, $wholeNumberFirstPartElements);

          Spaces must be used for alignment; tabs are not allowed
          Open

                          $numericParts[0] = $wholeNumberFirstPart . $curSeparator . $wholeNumberLastPart;

          Spaces must be used for alignment; tabs are not allowed
          Open

               */

          Spaces must be used for alignment; tabs are not allowed
          Open

                  $currencyDecimalPlaces = $this->numberOfDecimal;

          Spaces must be used for alignment; tabs are not allowed
          Open

                  $value = number_format($value, $currencyDecimalPlaces, '.', '');

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $curSeparator = ' ';

          Spaces must be used for alignment; tabs are not allowed
          Open

                  }

          Spaces must be used for alignment; tabs are not allowed
          Open

                      }

          Spaces must be used for alignment; tabs are not allowed
          Open

                  }

          Spaces must be used for alignment; tabs are not allowed
          Open

                      if ($value < 0) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $wholeNumberParts = str_split($wholeNumber, 3);

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $numericParts = explode('.', $value);

          Spaces must be used for alignment; tabs are not allowed
          Open

                      //check the whole number is negative value, then separate the negative symbol from whole number

          Spaces must be used for alignment; tabs are not allowed
          Open

                          $wholeNumberFirstPart = str_pad($wholeNumberFirstPart, $numberLength + $gapsToBeFilled, '0', STR_PAD_LEFT);

          Spaces must be used for alignment; tabs are not allowed
          Open

                      }

          Spaces must be used for alignment; tabs are not allowed
          Open

               *

          Spaces must be used for alignment; tabs are not allowed
          Open

              public function getDBInsertedValue($user = null, $skipConversion = false)

          Spaces must be used for alignment; tabs are not allowed
          Open

                  }

          Spaces must be used for alignment; tabs are not allowed
          Open

                  if ($value < 0) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                  if ($currencyPattern == $this->CURRENCY_PATTERN_PLAIN) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                  if ($currencyPattern == $this->CURRENCY_PATTERN_SINGLE_GROUPING) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                          $wholeNumberFirstPartElements = str_split($wholeNumberFirstPart, 2);

          Spaces must be used for alignment; tabs are not allowed
          Open

                  if (empty($user)) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                      // Pad the rest of the length in the number string with Leading 0, to get it to the multiples of 3

          Spaces must be used for alignment; tabs are not allowed
          Open

                      if ($negativeNumber) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                      if ($value < 0) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                      }

          Spaces must be used for alignment; tabs are not allowed
          Open

                              $gapsToBeFilled = 2 - $OddGroupLength;

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $user = \App\User::getCurrentUserModel();

          Spaces must be used for alignment; tabs are not allowed
          Open

                  }

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $wholeNumberLastPart = substr($wholeNumber, -3);

          Spaces must be used for alignment; tabs are not allowed
          Open

                          $numericParts[0] = $wholeNumberFirstPart . $curSeparator . $wholeNumberLastPart;

          Spaces must be used for alignment; tabs are not allowed
          Open

                      return $sign . $number;

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $numberLength = \strlen($wholeNumber);

          Spaces must be used for alignment; tabs are not allowed
          Open

                          } else {

          Spaces must be used for alignment; tabs are not allowed
          Open

                      }

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $number = implode($decSeparator, $numericParts);

          Spaces must be used for alignment; tabs are not allowed
          Open

                  return $value;

          Spaces must be used for alignment; tabs are not allowed
          Open

               * Returns the Currency value without formatting for DB Operations.

          Spaces must be used for alignment; tabs are not allowed
          Open

               * @param \App\User $user

          Spaces must be used for alignment; tabs are not allowed
          Open

                  $this->initialize($user);

          Spaces must be used for alignment; tabs are not allowed
          Open

                          $numericParts[0] = $wholeNumberLastPart;

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $number = implode($decSeparator, $numericParts);

          Spaces must be used for alignment; tabs are not allowed
          Open

                      }

          Spaces must be used for alignment; tabs are not allowed
          Open

                  if ($currencyPattern == $this->CURRENCY_PATTERN_MIXED_GROUPING) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                          $positiveValues = explode('-', $wholeNumber);

          Spaces must be used for alignment; tabs are not allowed
          Open

                      return $sign . $number;

          Spaces must be used for alignment; tabs are not allowed
          Open

              {

          Spaces must be used for alignment; tabs are not allowed
          Open

                  }

          Spaces must be used for alignment; tabs are not allowed
          Open

                  if (empty($decSeparator)) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $numericParts = explode('.', $value);

          Spaces must be used for alignment; tabs are not allowed
          Open

                      if (0 != $wholeNumber) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                          $numericParts[0] = 0;

          Spaces must be used for alignment; tabs are not allowed
          Open

                          $numericParts[0] = '-' . $numericParts[0];

          Spaces must be used for alignment; tabs are not allowed
          Open

                      // First part of the number which needs separate division

          Spaces must be used for alignment; tabs are not allowed
          Open

                          // First grouping digits length

          Spaces must be used for alignment; tabs are not allowed
          Open

              /**

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $number = str_replace('.', $decSeparator, $value);

          Spaces must be used for alignment; tabs are not allowed
          Open

                          $wholeNumberFirstPart = substr($wholeNumber, 0, \strlen($wholeNumber) - 3);

          Spaces must be used for alignment; tabs are not allowed
          Open

                      // First grouping digits length

          Spaces must be used for alignment; tabs are not allowed
          Open

                      }

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $negativeNumber = false;

          Spaces must be used for alignment; tabs are not allowed
          Open

                      if (\strlen($wholeNumber) > 3) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                          if (0 != $wholeNumberFirstPart) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                          }

          Spaces must be used for alignment; tabs are not allowed
          Open

                      // Re-create the currency value combining the whole number and the decimal part using Decimal separator

          Spaces must be used for alignment; tabs are not allowed
          Open

                  if (empty($curSeparator)) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $sign = '-';

          Spaces must be used for alignment; tabs are not allowed
          Open

                      // Replace '.' with Decimal Separator

          Spaces must be used for alignment; tabs are not allowed
          Open

                      //check the whole number is negative value, then separate the negative symbol from whole number

          Spaces must be used for alignment; tabs are not allowed
          Open

                      }

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $wholeNumber = str_pad($wholeNumber, $numberLength + $gapsToBeFilled, '0', STR_PAD_LEFT);

          Spaces must be used for alignment; tabs are not allowed
          Open

                      } else {

          Spaces must be used for alignment; tabs are not allowed
          Open

                      //if its negative number, append-back the negative symbol to the whole number part

          Spaces must be used for alignment; tabs are not allowed
          Open

                          $negativeNumber = true;

          Spaces must be used for alignment; tabs are not allowed
          Open

                      }

          Spaces must be used for alignment; tabs are not allowed
          Open

                      if (!empty($wholeNumberFirstPart)) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                          $OddGroupLength = $numberLength % 2;

          Spaces must be used for alignment; tabs are not allowed
          Open

                  } else {

          Spaces must be used for alignment; tabs are not allowed
          Open

                      // Separate the numeric and decimal parts

          Spaces must be used for alignment; tabs are not allowed
          Open

                      // First part of the number which remains intact

          Spaces must be used for alignment; tabs are not allowed
          Open

                  $decSeparator = $this->decimalSeparator;

          Spaces must be used for alignment; tabs are not allowed
          Open

                      } else {

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $value = substr($value, 1);

          Spaces must be used for alignment; tabs are not allowed
          Open

                          $positiveValues = explode('-', $wholeNumber);

          Spaces must be used for alignment; tabs are not allowed
          Open

                      }

          Spaces must be used for alignment; tabs are not allowed
          Open

                      }

          Spaces must be used for alignment; tabs are not allowed
          Open

                          $gapsToBeFilled = 3 - $OddGroupLength;

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $numericParts[0] = $wholeNumber = implode($curSeparator, $wholeNumberParts);

          Spaces must be used for alignment; tabs are not allowed
          Open

                      return $sign . $number;

          Spaces must be used for alignment; tabs are not allowed
          Open

                      }

          Spaces must be used for alignment; tabs are not allowed
          Open

                          if ($OddGroupLength > 0) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                          // Split the first part of tne number into chunks of 2 digits

          Spaces must be used for alignment; tabs are not allowed
          Open

                              $wholeNumberFirstPart = 0;

          Spaces must be used for alignment; tabs are not allowed
          Open

                      } else {

          Spaces must be used for alignment; tabs are not allowed
          Open

              }

          Spaces must be used for alignment; tabs are not allowed
          Open

                  }

          Spaces must be used for alignment; tabs are not allowed
          Open

                      // Separate the numeric and decimal parts

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $numericParts = explode('.', $value);

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $gapsToBeFilled = 0;

          Spaces must be used for alignment; tabs are not allowed
          Open

                  }

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $wholeNumberLastPart = substr($wholeNumber, -3);

          Spaces must be used for alignment; tabs are not allowed
          Open

                          $numericParts[0] = $wholeNumberLastPart;

          Spaces must be used for alignment; tabs are not allowed
          Open

                      if ($negativeNumber) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                  $self = new self($value);

          Spaces must be used for alignment; tabs are not allowed
          Open

                  }

          Spaces must be used for alignment; tabs are not allowed
          Open

                  if ($user->getDetail('truncate_trailing_zeros')) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                  }

          Spaces must be used for alignment; tabs are not allowed
          Open

                  $dbValue = (float) preg_replace('/[^0-9\.-]/', '', $dbValue);

          Spaces must be used for alignment; tabs are not allowed
          Open

                  if (false === $skipConversion) {

          Spaces must be used for alignment; tabs are not allowed
          Open

              }

          Spaces must be used for alignment; tabs are not allowed
          Open

                  return null;

          Spaces must be used for alignment; tabs are not allowed
          Open

              }

          Spaces must be used for alignment; tabs are not allowed
          Open

                          if (isset($fieldValue[1]) && 1 <= \strlen($fieldValue[1])) {

          Spaces must be used for alignment; tabs are not allowed
          Open

              }

          Spaces must be used for alignment; tabs are not allowed
          Open

                  $decSeparator = $this->decimalSeparator;

          Spaces must be used for alignment; tabs are not allowed
          Open

              /**

          Spaces must be used for alignment; tabs are not allowed
          Open

               * Returns the Currency value without formatting for DB Operations.

          Spaces must be used for alignment; tabs are not allowed
          Open

               * @param \App\User $user

          Spaces must be used for alignment; tabs are not allowed
          Open

              public static function getDBCurrencyId()

          Spaces must be used for alignment; tabs are not allowed
          Open

                  return $amount / $conversionRate;

          Spaces must be used for alignment; tabs are not allowed
          Open

                      }

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $curSeparator = ' ';

          Spaces must be used for alignment; tabs are not allowed
          Open

               * @return Number

          Spaces must be used for alignment; tabs are not allowed
          Open

                      return 0;

          Spaces must be used for alignment; tabs are not allowed
          Open

               * Function to get the default CRM currency.

          Spaces must be used for alignment; tabs are not allowed
          Open

                  return round($amount * $conversionRate, $currencyField->maxNumberOfDecimals);

          Spaces must be used for alignment; tabs are not allowed
          Open

               *

          Spaces must be used for alignment; tabs are not allowed
          Open

                  }

          Spaces must be used for alignment; tabs are not allowed
          Open

               */

          Spaces must be used for alignment; tabs are not allowed
          Open

                  if (!$user) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                      if (0 !== strpos($value, $user->getDetail('currency_decimal_separator'))) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                  if (empty($curSeparator)) {

          Spaces must be used for alignment; tabs are not allowed
          Open

              {

          Spaces must be used for alignment; tabs are not allowed
          Open

                  $currencyField = new self($amount);

          Spaces must be used for alignment; tabs are not allowed
          Open

              public function currencyDecimalFormat($value, $user = null)

          Spaces must be used for alignment; tabs are not allowed
          Open

                      if (0 === (int) $valueField || !isset($fieldValue[1]) || \strlen($fieldValue[1]) <= 1) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                  }

          Spaces must be used for alignment; tabs are not allowed
          Open

                  }

          Spaces must be used for alignment; tabs are not allowed
          Open

               *

          Spaces must be used for alignment; tabs are not allowed
          Open

               */

          Spaces must be used for alignment; tabs are not allowed
          Open

              public static function convertFromDollar($amount, $conversionRate)

          Spaces must be used for alignment; tabs are not allowed
          Open

                  if (empty($decSeparator)) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $decSeparator = ' ';

          Spaces must be used for alignment; tabs are not allowed
          Open

                  $dbValue = str_replace($curSeparator, '', $this->value);

          Spaces must be used for alignment; tabs are not allowed
          Open

               * @param Number    $value

          Spaces must be used for alignment; tabs are not allowed
          Open

              /**

          Spaces must be used for alignment; tabs are not allowed
          Open

                  if (0 == $conversionRate) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $valueField = $fieldValue[0];

          Spaces must be used for alignment; tabs are not allowed
          Open

                              return $value = $valueField . $decSeparator . $fieldValue[1];

          Spaces must be used for alignment; tabs are not allowed
          Open

                          }

          Spaces must be used for alignment; tabs are not allowed
          Open

                  $curSeparator = $this->currencySeparator;

          Spaces must be used for alignment; tabs are not allowed
          Open

              }

          Spaces must be used for alignment; tabs are not allowed
          Open

                          return $value = $valueField;

          Spaces must be used for alignment; tabs are not allowed
          Open

                  }

          Spaces must be used for alignment; tabs are not allowed
          Open

              {

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $decSeparator = $user->getDetail('currency_decimal_separator');

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $fieldValue = explode(App\Purifier::decodeHtml($decSeparator), $value);

          Spaces must be used for alignment; tabs are not allowed
          Open

                              return $value = $valueField;

          Spaces must be used for alignment; tabs are not allowed
          Open

                  return $dbValue;

          Spaces must be used for alignment; tabs are not allowed
          Open

              public static function convertToDollar($amount, $conversionRate)

          Spaces must be used for alignment; tabs are not allowed
          Open

              {

          Spaces must be used for alignment; tabs are not allowed
          Open

              {

          Spaces must be used for alignment; tabs are not allowed
          Open

                  return $self->getDBInsertedValue($user, $skipConversion);

          Spaces must be used for alignment; tabs are not allowed
          Open

               * @return int Default system currency id

          Spaces must be used for alignment; tabs are not allowed
          Open

                  if ($id) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                      return $id;

          Spaces must be used for alignment; tabs are not allowed
          Open

              {

          Spaces must be used for alignment; tabs are not allowed
          Open

                          $value = \App\Fields\Double::truncateZeros($value);

          Spaces must be used for alignment; tabs are not allowed
          Open

                      }

          Spaces must be used for alignment; tabs are not allowed
          Open

                  $dbValue = str_replace($decSeparator, '.', $dbValue);

          Spaces must be used for alignment; tabs are not allowed
          Open

              }

          Spaces must be used for alignment; tabs are not allowed
          Open

                  if (empty($value)) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                  }

          Spaces must be used for alignment; tabs are not allowed
          Open

                  }

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $user = \App\User::getCurrentUserModel();

          Spaces must be used for alignment; tabs are not allowed
          Open

                          }

          Spaces must be used for alignment; tabs are not allowed
          Open

                  return $value;

          Spaces must be used for alignment; tabs are not allowed
          Open

               * @param bool      $skipConversion

          Spaces must be used for alignment; tabs are not allowed
          Open

               *

          Spaces must be used for alignment; tabs are not allowed
          Open

                      return 0;

          Spaces must be used for alignment; tabs are not allowed
          Open

                          if (!isset($fieldValue[1])) {

          Spaces must be used for alignment; tabs are not allowed
          Open

                      return preg_replace('/(?<=\\.[0-9])[0]+$/', '', $value);

          Spaces must be used for alignment; tabs are not allowed
          Open

                      $dbValue = self::convertToDollar($dbValue, $this->conversionRate);

          Spaces must be used for alignment; tabs are not allowed
          Open

              public static function convertToDBFormat($value, $user = null, $skipConversion = false)

          Spaces must be used for alignment; tabs are not allowed
          Open

                  $id = (new \App\Db\Query())->select(['id'])->from('vtiger_currency_info')->where(['<', 'defaultid', 0])->scalar();

          Spaces must be used for alignment; tabs are not allowed
          Open

              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

              private $CURRENCY_PATTERN_MIXED_GROUPING = '12,34,56,789';

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public $currencySymbol;

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @param Number $value

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

              private $CURRENCY_PATTERN_SINGLE_GROUPING = '123456,789';

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

              {

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Currency Separator for example (comma, dot, hash).

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public $value;

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @var int

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Constructor.

          Spaces must be used to indent lines; tabs are not allowed
          Open

              private $CURRENCY_PATTERN_THOUSAND_GROUPING = '123,456,789';

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public $decimalSeparator = '.';

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Currency Id.

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Currency Symbol.

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public $currencyFormat = '123,456,789';

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @var string

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public $currencySymbolPlacement;

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $this->value = $value;

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Value to be converted.

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

              private $CURRENCY_PATTERN_PLAIN = '123456789';

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public $currencyId = 1;

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Maximum Number Of Currency Decimals.

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @var string

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public $numberOfDecimal = 3;

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Currency Conversion Rate.

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @var string

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Number of Decimal Numbers.

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @var Number

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Currency Format(3,3,3) or (2,2,3).

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @var <type>

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @var int

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Currency Symbol Placement.

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @param Number $value

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @param \App\User $user

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public $currencySeparator = ',';

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Initializes the User's Currency Details.

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Decimal Separator for example (dot, comma, space).

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @var Number

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public $conversionRate = 1;

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public function __construct($value)

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public $maxNumberOfDecimals = 5;

          Spaces must be used to indent lines; tabs are not allowed
          Open

              {

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @deprecated        Recommend using function \App\Fields\Currency::formatToDisplay

          Line exceeds 120 characters; contains 123 characters
          Open

               * Static Function that appends the currency symbol to a given currency value, based on the preferred symbol placement.

          Line exceeds 120 characters; contains 135 characters
          Open

              public static function convertToUserFormatSymbol($value, $skipConversion = false, $currencySymbol = false, $skipFormatting = false)

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  if (!empty($user->getDetail('currency_grouping_pattern'))) {

          Line exceeds 120 characters; contains 164 characters
          Open

                      $this->decimalSeparator = str_replace("\xC2\xA0", ' ', html_entity_decode($user->getDetail('currency_decimal_separator'), ENT_QUOTES, $defaultCharset));

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  } else {

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public function getCurrencySymbol()

          Spaces must be used to indent lines; tabs are not allowed
          Open

              {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $defaultCharset = App\Config::main('default_charset');

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public function initialize($user = null)

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $this->currencyId = self::getDBCurrencyId();

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $this->currencySymbol = $currencyData['currency_symbol'];

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @global Users    $current_user

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  }

          Spaces must be used to indent lines; tabs are not allowed
          Open

              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @param mixed     $skipFormatting

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $this->currencyFormat = html_entity_decode($user->getDetail('currency_grouping_pattern'), ENT_QUOTES, $defaultCharset);

          Line exceeds 120 characters; contains 131 characters
          Open

                      $this->currencyFormat = html_entity_decode($user->getDetail('currency_grouping_pattern'), ENT_QUOTES, $defaultCharset);

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  if (empty($user)) {

          Line exceeds 120 characters; contains 201 characters
          Open

                  $this->numberOfDecimal = (empty($user->getDetail('no_of_currency_decimals')) && 0 !== (int) $user->getDetail('no_of_currency_decimals')) ? 2 : (int) $user->getDetail('no_of_currency_decimals');

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @param bool      $skipConversion

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $this->numberOfDecimal = (empty($user->getDetail('no_of_currency_decimals')) && 0 !== (int) $user->getDetail('no_of_currency_decimals')) ? 2 : (int) $user->getDetail('no_of_currency_decimals');

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $this->currencyId = $user->getDetail('currency_id');

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $this->conversionRate = $currencyData['conversion_rate'];

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @param \App\User $user

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $currencyData = \App\Fields\Currency::getById($this->currencyId);

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @param mixed     $value

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $user = \App\User::getCurrentUserModel();

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  if (!empty($user->getDetail('currency_id'))) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $this->currencySeparator = str_replace("\xC2\xA0", ' ', html_entity_decode($user->getDetail('currency_grouping_separator'), ENT_QUOTES, $defaultCharset));

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  return $this->currencySymbol;

          Spaces must be used to indent lines; tabs are not allowed
          Open

              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Line exceeds 120 characters; contains 166 characters
          Open

                      $this->currencySeparator = str_replace("\xC2\xA0", ' ', html_entity_decode($user->getDetail('currency_grouping_separator'), ENT_QUOTES, $defaultCharset));

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  }

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Returns the Formatted Currency value for the User.

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $this->decimalSeparator = str_replace("\xC2\xA0", ' ', html_entity_decode($user->getDetail('currency_decimal_separator'), ENT_QUOTES, $defaultCharset));

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $this->currencySymbolPlacement = $user->getDetail('currency_symbol_placement');

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Line exceeds 120 characters; contains 127 characters
          Open

                      // Second Part of the number (last 3 digits) which should be separated from the First part using Currency Separator

          Line exceeds 120 characters; contains 123 characters
          Open

                          $wholeNumberFirstPart = str_pad($wholeNumberFirstPart, $numberLength + $gapsToBeFilled, '0', STR_PAD_LEFT);

          Line exceeds 120 characters; contains 127 characters
          Open

                      // Second Part of the number (last 3 digits) which should be separated from the First part using Currency Separator

          Line exceeds 120 characters; contains 122 characters
          Open

                  $id = (new \App\Db\Query())->select(['id'])->from('vtiger_currency_info')->where(['<', 'defaultid', 0])->scalar();

          The variable $OddGroupLength is not named in camelCase.
          Open

              private function formatCurrencyValue($value)
              {
                  $currencyPattern = $this->currencyFormat;
                  $curSeparator = $this->currencySeparator;
                  $decSeparator = $this->decimalSeparator;
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          CamelCaseVariableName

          Since: 0.2

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

          Example

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

          Source

          The variable $OddGroupLength is not named in camelCase.
          Open

              private function formatCurrencyValue($value)
              {
                  $currencyPattern = $this->currencyFormat;
                  $curSeparator = $this->currencySeparator;
                  $decSeparator = $this->decimalSeparator;
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          CamelCaseVariableName

          Since: 0.2

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

          Example

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

          Source

          The variable $OddGroupLength is not named in camelCase.
          Open

              private function formatCurrencyValue($value)
              {
                  $currencyPattern = $this->currencyFormat;
                  $curSeparator = $this->currencySeparator;
                  $decSeparator = $this->decimalSeparator;
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          CamelCaseVariableName

          Since: 0.2

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

          Example

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

          Source

          The variable $OddGroupLength is not named in camelCase.
          Open

              private function formatCurrencyValue($value)
              {
                  $currencyPattern = $this->currencyFormat;
                  $curSeparator = $this->currencySeparator;
                  $decSeparator = $this->decimalSeparator;
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          CamelCaseVariableName

          Since: 0.2

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

          Example

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

          Source

          The variable $OddGroupLength is not named in camelCase.
          Open

              private function formatCurrencyValue($value)
              {
                  $currencyPattern = $this->currencyFormat;
                  $curSeparator = $this->currencySeparator;
                  $decSeparator = $this->decimalSeparator;
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          CamelCaseVariableName

          Since: 0.2

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

          Example

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

          Source

          The variable $OddGroupLength is not named in camelCase.
          Open

              private function formatCurrencyValue($value)
              {
                  $currencyPattern = $this->currencyFormat;
                  $curSeparator = $this->currencySeparator;
                  $decSeparator = $this->decimalSeparator;
          Severity: Minor
          Found in include/fields/CurrencyField.php by phpmd

          CamelCaseVariableName

          Since: 0.2

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

          Example

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

          Source

          There are no issues that match your filters.

          Category
          Status