kwn/number-to-words

View on GitHub

Showing 131 of 207 total issues

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

    public function transformToWords(int $number, int $power): string
    {
        $units = $number % 10;
        $tens = (int) ($number / 10) % 10;
        $hundreds = (int) ($number / 100) % 10;
Severity: Minor
Found in src/Language/Serbian/SerbianTripletTransformer.php - About 55 mins to fix

Cognitive Complexity

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

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

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

Further reading

Function convertTriplet has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    protected function convertTriplet(string $chunk, $chunkLevel)
    {
        $triplet = (int)$chunk;

        $units = $triplet % 10;
Severity: Minor
Found in src/Language/Persian/PersianConverter.php - About 45 mins to fix

Cognitive Complexity

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

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

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

Further reading

Avoid deeply nested control flow statements.
Open

                        if ($powsuffix != '') {
                            $cursuffix .= $this->wordSeparator . $powsuffix;
                        }
Severity: Major
Found in src/Legacy/Numbers/Words/Locale/Et.php - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if ($powsuffix != '') {
                                $cursuffix .= $this->wordSeparator . $powsuffix;
                            }
    Severity: Major
    Found in src/Legacy/Numbers/Words/Locale/Sv.php - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if ($gt2000) {
                                  $return .= $this->thousandSeparator;
                              }
      Severity: Major
      Found in src/Legacy/Numbers/Words/Locale/Hu.php - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if ($powsuffix != '') {
                                    $cursuffix .= $this->wordSeparator . $powsuffix;
                                }
        Severity: Major
        Found in src/Legacy/Numbers/Words/Locale/Nl.php - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if ($powsuffix != '') {
                                      $cursuffix .= $this->wordSeparator . $powsuffix;
                                  }
          Severity: Major
          Found in src/Legacy/Numbers/Words/Locale/Lt.php - About 45 mins to fix

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

                public function getLevel($number)
                {
                    $lastTwoDigits = $number % 100;
                    $lastDigit = $number % 10;
                    $isUnit = log($number) === 1;
            Severity: Minor
            Found in src/CurrencyTransformer/LatvianCurrencyTransformer.php - About 35 mins to fix

            Cognitive Complexity

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

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

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

            Further reading

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

                public function transformToWords(int $number, int $power): string
                {
                    $units = $number % 10;
                    $tens = (int) ($number / 10) % 10;
                    $hundreds = (int) ($number / 100) % 10;
            Severity: Minor
            Found in src/Language/Bulgarian/BulgarianFemaleTripletTransformer.php - About 35 mins to fix

            Cognitive Complexity

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

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

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

            Further reading

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

                public function getLevel($number): int
                {
                    $lastTwoDigits = $number % 100;
                    $lastDigit = $number % 10;
                    $isUnit = log($number) === 1;
            Severity: Minor
            Found in src/CurrencyTransformer/LithuanianCurrencyTransformer.php - About 35 mins to fix

            Cognitive Complexity

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

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

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

            Further reading

            Avoid too many return statements within this method.
            Open

                    return $ret;
            Severity: Major
            Found in src/Legacy/Numbers/Words/Locale/Et.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return $return;
              Severity: Major
              Found in src/Legacy/Numbers/Words/Locale/Lt.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                        return $ret;
                Severity: Major
                Found in src/Legacy/Numbers/Words/Locale/Cs.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return 0;
                  Severity: Major
                  Found in src/CurrencyTransformer/LithuanianCurrencyTransformer.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                            return 2;
                    Severity: Major
                    Found in src/CurrencyTransformer/LithuanianCurrencyTransformer.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                              return 2;
                      Severity: Major
                      Found in src/CurrencyTransformer/LatvianCurrencyTransformer.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                return 'f';
                        Severity: Major
                        Found in src/Legacy/Numbers/Words/Locale/Ro.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                      return 0;
                          Severity: Major
                          Found in src/CurrencyTransformer/LatvianCurrencyTransformer.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                    return $return;
                            Severity: Major
                            Found in src/Legacy/Numbers/Words/Locale/Dk.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                      return $ret;
                              Severity: Major
                              Found in src/Legacy/Numbers/Words/Locale/Nl.php - About 30 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language