AMBERSIVE/laravel-vatvalidator

View on GitHub

Showing 11 of 11 total issues

VatCountries has 29 functions (exceeds 20 allowed). Consider refactoring.
Open

class VatCountries
{
    public static $countries = [
        'AT',
        'BE',
Severity: Minor
Found in src/Classes/VatCountries.php - About 3 hrs to fix

    Method boot has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function boot()
        {
    
            // Configs
            $this->publishes([
    Severity: Major
    Found in src/VatValidatorServiceProvider.php - About 2 hrs to fix

      Method check has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function check(String $vatId, bool $skipCheck = false): VatCompany
          {
              $vatId = str_replace([' ', '.', '-', ',', ', '], '', trim($vatId));
              $result = null;
      
      
      Severity: Minor
      Found in src/Classes/VatValidator.php - About 1 hr to fix

        Function boot has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            public function boot()
            {
        
                // Configs
                $this->publishes([
        Severity: Minor
        Found in src/VatValidatorServiceProvider.php - About 1 hr to fix

        Cognitive Complexity

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

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

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

        Further reading

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

            public function check(String $vatId, bool $skipCheck = false): VatCompany
            {
                $vatId = str_replace([' ', '.', '-', ',', ', '], '', trim($vatId));
                $result = null;
        
        
        Severity: Minor
        Found in src/Classes/VatValidator.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

        Avoid too many return statements within this method.
        Open

                        return $result->isValid();
        Severity: Major
        Found in src/VatValidatorServiceProvider.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return false;
          Severity: Major
          Found in src/VatValidatorServiceProvider.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                                return false;
            Severity: Major
            Found in src/VatValidatorServiceProvider.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                                  return true;
              Severity: Major
              Found in src/VatValidatorServiceProvider.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                return false;
                Severity: Major
                Found in src/VatValidatorServiceProvider.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                      return true;
                  Severity: Major
                  Found in src/VatValidatorServiceProvider.php - About 30 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language