kwn/number-to-words

View on GitHub

Showing 131 of 207 total issues

Function showDigitsGroup has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    private function showDigitsGroup(int $num, int $gender = 0, bool $last = false): string
    {
        /* A storage array for the return string.
             Positions 1, 3, 5 are intended for digit words
             and everything else (0, 2, 4) for "and" words.
Severity: Minor
Found in src/Legacy/Numbers/Words/Locale/Mk.php - About 4 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Method toWords has 105 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function toWords($number, $power = 0)
    {
        $return = '';

        if ($number < 0) {
Severity: Major
Found in src/Legacy/Numbers/Words/Locale/Hu.php - About 4 hrs to fix

    Method toWords has 105 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function toWords($number, $power = 0)
        {
            $return = '';
    
            if ($number < 0) {
    Severity: Major
    Found in src/Legacy/Numbers/Words/Locale/Id.php - About 4 hrs to fix

      Method toWords has 105 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function toWords($number, $power = 0)
          {
              $return = '';
      
              if ($number < 0) {
      Severity: Major
      Found in src/Legacy/Numbers/Words/Locale/Ms.php - About 4 hrs to fix

        Function showDigitsGroup has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

            private function showDigitsGroup($number, $last = false)
            {
                $ret = '';
        
                $units = $number % 10;
        Severity: Minor
        Found in src/Legacy/Numbers/Words/Locale/Fr/Be.php - About 4 hrs to fix

        Cognitive Complexity

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

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

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

        Further reading

        Method toWords has 98 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function toWords($num, $power = 0, $powsuffix = '')
            {
                $ret = '';
        
                if (substr($num, 0, 1) == '-') {
        Severity: Major
        Found in src/Legacy/Numbers/Words/Locale/Et.php - About 3 hrs to fix

          Function toWords has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function toWords(int $num = 0): string
              {
                  $ret = [];
          
                  $retMinus = '';
          Severity: Minor
          Found in src/Legacy/Numbers/Words/Locale/Mk.php - About 3 hrs to fix

          Cognitive Complexity

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

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

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

          Further reading

          Function showDigitsGroup has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
          Open

              private function showDigitsGroup($num, $gender = 0, $last = false)
              {
                  /* A storage array for the return string.
                       Positions 1, 3, 5 are intended for digit words
                       and everything else (0, 2, 4) for "and" words.
          Severity: Minor
          Found in src/Legacy/Numbers/Words/Locale/Bg.php - About 3 hrs to fix

          Cognitive Complexity

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

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

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

          Further reading

          File Mk.php has 322 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          namespace NumberToWords\Legacy\Numbers\Words\Locale;
          
          use NumberToWords\Legacy\Numbers\Words;
          Severity: Minor
          Found in src/Legacy/Numbers/Words/Locale/Mk.php - About 3 hrs to fix

            Function toWords has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function toWords($num = 0)
                {
                    $ret = [];
            
                    $ret_minus = '';
            Severity: Minor
            Found in src/Legacy/Numbers/Words/Locale/Bg.php - About 3 hrs to fix

            Cognitive Complexity

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

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

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

            Further reading

            Method showDigitsGroup has 76 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function showDigitsGroup(int $num, int $gender = 0, bool $last = false): string
                {
                    /* A storage array for the return string.
                         Positions 1, 3, 5 are intended for digit words
                         and everything else (0, 2, 4) for "and" words.
            Severity: Major
            Found in src/Legacy/Numbers/Words/Locale/Mk.php - About 3 hrs to fix

              Function toCurrencyWords has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function toCurrencyWords($currency, $decimal, $fraction = null)
                  {
                      $negative = 0;
                      $ret = [];
                      $noDecimals = false;
              Severity: Minor
              Found in src/Legacy/Numbers/Words/Locale/Pt/Br.php - About 2 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 toWords has 71 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function toWords(int $num = 0): string
                  {
                      $ret = [];
              
                      $retMinus = '';
              Severity: Major
              Found in src/Legacy/Numbers/Words/Locale/Mk.php - About 2 hrs to fix

                Function toCurrencyWords has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function toCurrencyWords($currency, $decimal, $fraction = null)
                    {
                        $return = '';
                        $currency = strtoupper($currency);
                
                
                Severity: Minor
                Found in src/Legacy/Numbers/Words/Locale/Dk.php - About 2 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

                Function showDigitsGroup has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function showDigitsGroup($number, $noun, $forceNoun = false, $forcePlural = false)
                    {
                        $ret = '';
                
                        $units = $number % 10;
                Severity: Minor
                Found in src/Legacy/Numbers/Words/Locale/Ro.php - About 2 hrs to fix

                Cognitive Complexity

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

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

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

                Further reading

                File Es.php has 280 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                namespace NumberToWords\Legacy\Numbers\Words\Locale;
                
                use NumberToWords\Exception\NumberToWordsException;
                Severity: Minor
                Found in src/Legacy/Numbers/Words/Locale/Es.php - About 2 hrs to fix

                  File Bg.php has 279 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  
                  namespace NumberToWords\Legacy\Numbers\Words\Locale;
                  
                  use NumberToWords\Legacy\Numbers\Words;
                  Severity: Minor
                  Found in src/Legacy/Numbers/Words/Locale/Bg.php - About 2 hrs to fix

                    Method toWords has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function toWords($number, $use_suffix = true, $use_spaces = true)
                        {
                            $space = $use_spaces ? ' ' : '';
                            if (!is_numeric($number)) {
                                return false;
                    Severity: Major
                    Found in src/Legacy/Numbers/Words/Locale/Ka.php - About 2 hrs to fix

                      Function getWordsBySplittingIntoTriplets has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function getWordsBySplittingIntoTriplets(int $number): array
                          {
                              $words = [];
                              $triplets = $this->numberToTripletsConverter->convertToTriplets($number);
                      
                      
                      Severity: Minor
                      Found in src/NumberTransformer/GenericNumberTransformer.php - About 2 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

                      Function transformToWords has a Cognitive Complexity of 19 (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/BulgarianTripletTransformer.php - About 2 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

                      Severity
                      Category
                      Status
                      Source
                      Language