mrcnpdlk/validator

View on GitHub

Showing 16 of 54 total issues

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

    private function parseNumberPlan(string $plan)
    {
        if (preg_match("/(?'prefix'[\d]*)(\((?'suffix'[\d\-,]*)\))?/", strval($plan), $f)) {
            $answer = [];
            $prefix = $f['prefix'];
Severity: Minor
Found in src/mrcnpdlk/Validator/Types/Phone.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 isValid has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function isValid($checkedValue, bool $asEx = false): bool
    {
        try {
            static::isValidType($checkedValue, static::TYPE_STRING, true);
            if (!preg_match('/^[A-NPR-Z]{3}[0-9]{6}$/', $checkedValue)) {
Severity: Major
Found in src/mrcnpdlk/Validator/Types/IDCard.php - About 2 hrs to fix

    Method isValidType has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected static function isValidType($checkedValue, string $requiredType, bool $asEx = false)
        {
            $requiredType = strtolower($requiredType);
    
            switch ($requiredType) {
    Severity: Minor
    Found in src/mrcnpdlk/Validator/Types/TypeAbstract.php - About 1 hr to fix

      Function isValidType has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          protected static function isValidType($checkedValue, string $requiredType, bool $asEx = false)
          {
              $requiredType = strtolower($requiredType);
      
              switch ($requiredType) {
      Severity: Minor
      Found in src/mrcnpdlk/Validator/Types/TypeAbstract.php - About 1 hr to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          private function parseNumberPlan(string $plan)
          {
              if (preg_match("/(?'prefix'[\d]*)(\((?'suffix'[\d\-,]*)\))?/", strval($plan), $f)) {
                  $answer = [];
                  $prefix = $f['prefix'];
      Severity: Minor
      Found in src/mrcnpdlk/Validator/Types/Phone.php - About 1 hr to fix

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

            public static function isValid($checkedValue, bool $asEx = false): bool
            {
                try {
                    static::isValidType($checkedValue, static::TYPE_STRING, true);
        
        
        Severity: Minor
        Found in src/mrcnpdlk/Validator/Types/Regon.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 isValid has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function isValid($checkedValue, bool $asEx = false): bool
            {
                try {
                    static::isValidType($checkedValue, static::TYPE_STRING, true);
                    if (strlen($checkedValue) !== 9 && strlen($checkedValue) !== 11) {
        Severity: Minor
        Found in src/mrcnpdlk/Validator/Types/Phone.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

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

            public function getRegion()
            {
                $sRegion = null;
                if ($this->isMobile()) {
                    $nr = $this->getNationalFormat();
        Severity: Minor
        Found in src/mrcnpdlk/Validator/Types/Phone.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

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

            public static function isValid($checkedValue, bool $asEx = false): bool
            {
                try {
                    static::isValidType($checkedValue, static::TYPE_STRING, true);
                    $checkedValue = static::clean($checkedValue);
        Severity: Minor
        Found in src/mrcnpdlk/Validator/Types/Nrb.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 isValid has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function isValid($checkedValue, bool $asEx = false): bool
            {
                try {
                    if (is_int($checkedValue)) {
                        $sIp = long2ip($checkedValue);
        Severity: Minor
        Found in src/mrcnpdlk/Validator/Types/IPv4.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 isValid has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function isValid($checkedValue, bool $asEx = false): bool
            {
                try {
                    static::isValidType($checkedValue, static::TYPE_STRING, true);
        
        
        Severity: Minor
        Found in src/mrcnpdlk/Validator/Types/Nip.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 isValid has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function isValid($checkedValue, bool $asEx = false): bool
            {
                try {
                    static::isValidType($checkedValue, static::TYPE_STRING, true);
        
        
        Severity: Minor
        Found in src/mrcnpdlk/Validator/Types/Pesel.php - About 25 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 parseBirthDate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            private function parseBirthDate()
            {
                $inYear  = intval($this->checkedValue [0] . $this->checkedValue [1]);
                $inMonth = intval($this->checkedValue [2] . $this->checkedValue [3]);
                $inDay   = intval($this->checkedValue [4] . $this->checkedValue [5]);
        Severity: Minor
        Found in src/mrcnpdlk/Validator/Types/Pesel.php - About 25 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 isValid has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function isValid($checkedValue, bool $asEx = false): bool
            {
                try {
                    static::isValidType($checkedValue, static::TYPE_STRING, true);
        
        
        Severity: Minor
        Found in src/mrcnpdlk/Validator/Types/Pna.php - About 25 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 isValid has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function isValid($checkedValue, bool $asEx = false): bool
            {
                try {
                    static::isValidType($checkedValue, static::TYPE_STRING, true);
                    if (!preg_match('/^[A-NPR-Z]{3}[0-9]{6}$/', $checkedValue)) {
        Severity: Minor
        Found in src/mrcnpdlk/Validator/Types/IDCard.php - About 25 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 getUkeMobilePlan has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            private function getUkeMobilePlan()
            {
                if (empty($this->ukeMobilePlan)) {
                    $oXml = new \SimpleXMLElement(file_get_contents(__DIR__ . '/../Databases/T2-PLMN_T9-MVNO.xml'));
        
        
        Severity: Minor
        Found in src/mrcnpdlk/Validator/Types/Phone.php - About 25 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

        Severity
        Category
        Status
        Source
        Language