jidaikobo-shibata/a11yc

View on GitHub
classes/Validate.php

Summary

Maintainability
D
1 day
Test Coverage

File Validate.php has 311 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * A11yc\Validate
 *
 * @package    part of A11yc
Severity: Minor
Found in classes/Validate.php - About 3 hrs to fix

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

        public static function addErrorToHtml(
            $url,
            $error_id,
            $s_errors,
            $ignore_vals = '',
    Severity: Minor
    Found in classes/Validate.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 addErrorToHtml has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function addErrorToHtml(
            $url,
            $error_id,
            $s_errors,
            $ignore_vals = '',
    Severity: Major
    Found in classes/Validate.php - About 2 hrs to fix

      Method revertHtml has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function revertHtml($html)
          {
              if (is_array($html)) Util::error('invalid HTML was given');
      
              $retval = str_replace(
      Severity: Minor
      Found in classes/Validate.php - About 1 hr to fix

        Function ignoreElementsOrComments has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            private static function ignoreElementsOrComments($ignore_vals, $html)
            {
                $replaces_ignores = array();
                if ($ignore_vals)
                {
        Severity: Minor
        Found in classes/Validate.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 html has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function html($url, $html, $codes = array(), $ua = 'using', $force = false)
            {
        //        if ( ! is_string($html)) Util::error('invalid HTML was given');
                $html = ! is_string($html) ? '' : $html;
        
        
        Severity: Minor
        Found in classes/Validate.php - About 1 hr to fix

          Method addErrorToHtml has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  $url,
                  $error_id,
                  $s_errors,
                  $ignore_vals = '',
                  $issue_html = ''
          Severity: Minor
          Found in classes/Validate.php - About 35 mins to fix

            Method replaceSafeStrings has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                private static function replaceSafeStrings($replaces, $k, $lv, $error_id, $current_err)
            Severity: Minor
            Found in classes/Validate.php - About 35 mins to fix

              Method html has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public static function html($url, $html, $codes = array(), $ua = 'using', $force = false)
              Severity: Minor
              Found in classes/Validate.php - About 35 mins to fix

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

                    private static function setMessage($url)
                    {
                        $yml = Yaml::fetch();
                        $all_errs = array(
                            'notices' => array(),
                Severity: Minor
                Found in classes/Validate.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 setCurrentErr has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function setCurrentErr($url, $error_id, $issue_html = '')
                    {
                        $yml = Yaml::fetch();
                        $current_err = array();
                
                
                Severity: Minor
                Found in classes/Validate.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 html has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function html($url, $html, $codes = array(), $ua = 'using', $force = false)
                    {
                //        if ( ! is_string($html)) Util::error('invalid HTML was given');
                        $html = ! is_string($html) ? '' : $html;
                
                
                Severity: Minor
                Found in classes/Validate.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

                There are no issues that match your filters.

                Category
                Status