CaffGeek/MBACNationals

View on GitHub
Web.Admin/2014/wordpress/wp-includes/SimplePie/IRI.php

Summary

Maintainability
F
1 wk
Test Coverage

File IRI.php has 843 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * SimplePie
 *
 * A PHP-Based RSS and Atom Feed Framework.
Severity: Major
Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/IRI.php - About 2 days to fix

    Function remove_iunreserved_percent_encoded has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function remove_iunreserved_percent_encoded($match)
        {
            // As we just have valid percent encoded sequences we can just explode
            // and ignore the first member of the returned array (an empty string).
            $bytes = explode('%', $match[0]);
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/IRI.php - About 7 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 replace_invalid_with_pct_encoding has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function replace_invalid_with_pct_encoding($string, $extra_chars, $iprivate = false)
        {
            // Normalize as many pct-encoded sections as possible
            $string = preg_replace_callback('/(?:%[A-Fa-f0-9]{2})+/', array($this, 'remove_iunreserved_percent_encoded'), $string);
    
    
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/IRI.php - About 6 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 absolutize has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function absolutize($base, $relative)
        {
            if (!($relative instanceof SimplePie_IRI))
            {
                $relative = new SimplePie_IRI($relative);
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/IRI.php - About 6 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

    Consider simplifying this complex logical expression.
    Open

                    if (
                        // Invalid sequences
                        !$valid
                        // Non-shortest form sequences are invalid
                        || $length > 1 && $character <= 0x7F
    Severity: Critical
    Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/IRI.php - About 6 hrs to fix

      Consider simplifying this complex logical expression.
      Open

                  if (
                      // Invalid sequences
                      !$valid
                      // Non-shortest form sequences are invalid
                      || $length > 1 && $character <= 0x7F
      Severity: Critical
      Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/IRI.php - About 4 hrs to fix

        Method remove_iunreserved_percent_encoded has 94 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function remove_iunreserved_percent_encoded($match)
            {
                // As we just have valid percent encoded sequences we can just explode
                // and ignore the first member of the returned array (an empty string).
                $bytes = explode('%', $match[0]);
        Severity: Major
        Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/IRI.php - About 3 hrs to fix

          Method replace_invalid_with_pct_encoding has 90 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function replace_invalid_with_pct_encoding($string, $extra_chars, $iprivate = false)
              {
                  // Normalize as many pct-encoded sections as possible
                  $string = preg_replace_callback('/(?:%[A-Fa-f0-9]{2})+/', array($this, 'remove_iunreserved_percent_encoded'), $string);
          
          
          Severity: Major
          Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/IRI.php - About 3 hrs to fix

            Method absolutize has 83 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function absolutize($base, $relative)
                {
                    if (!($relative instanceof SimplePie_IRI))
                    {
                        $relative = new SimplePie_IRI($relative);
            Severity: Major
            Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/IRI.php - About 3 hrs to fix

              SimplePie_IRI has 27 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class SimplePie_IRI
              {
                  /**
                   * Scheme
                   *
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/IRI.php - About 3 hrs to fix

                Method set_authority has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function set_authority($authority)
                    {
                        static $cache;
                        if (!$cache)
                            $cache = array();
                Severity: Major
                Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/IRI.php - About 2 hrs to fix

                  Method remove_dot_segments has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function remove_dot_segments($input)
                      {
                          $output = '';
                          while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input === '.' || $input === '..')
                          {
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/IRI.php - About 1 hr to fix

                    Function set_authority has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function set_authority($authority)
                        {
                            static $cache;
                            if (!$cache)
                                $cache = array();
                    Severity: Minor
                    Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/IRI.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 set_iri has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function set_iri($iri)
                        {
                            static $cache;
                            if (!$cache)
                            {
                    Severity: Minor
                    Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/IRI.php - About 1 hr to fix

                      Function set_host has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function set_host($ihost)
                          {
                              if ($ihost === null)
                              {
                                  $this->ihost = null;
                      Severity: Minor
                      Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/IRI.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 parse_iri has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function parse_iri($iri)
                          {
                              $iri = trim($iri, "\x20\x09\x0A\x0C\x0D");
                              if (preg_match('/^((?P<scheme>[^:\/?#]+):)?(\/\/(?P<authority>[^\/?#]*))?(?P<path>[^?#]*)(\?(?P<query>[^#]*))?(#(?P<fragment>.*))?$/', $iri, $match))
                              {
                      Severity: Minor
                      Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/IRI.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 set_host has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function set_host($ihost)
                          {
                              if ($ihost === null)
                              {
                                  $this->ihost = null;
                      Severity: Minor
                      Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/IRI.php - About 1 hr to fix

                        Method __get has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function __get($name)
                            {
                                // isset() returns false for null, we don't want to do that
                                // Also why we use array_key_exists below instead of isset()
                                $props = get_object_vars($this);
                        Severity: Minor
                        Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/IRI.php - About 1 hr to fix

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

                              protected function remove_dot_segments($input)
                              {
                                  $output = '';
                                  while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input === '.' || $input === '..')
                                  {
                          Severity: Minor
                          Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/IRI.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

                          Consider simplifying this complex logical expression.
                          Open

                                  if ($this->ipath !== '' &&
                                      (
                                          $isauthority && (
                                              $this->ipath[0] !== '/' ||
                                              substr($this->ipath, 0, 2) === '//'
                          Severity: Critical
                          Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/IRI.php - About 1 hr to fix

                            Method get_iri has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function get_iri()
                                {
                                    if (!$this->is_valid())
                                    {
                                        return false;
                            Severity: Minor
                            Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/IRI.php - About 1 hr to fix

                              Method parse_iri has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  protected function parse_iri($iri)
                                  {
                                      $iri = trim($iri, "\x20\x09\x0A\x0C\x0D");
                                      if (preg_match('/^((?P<scheme>[^:\/?#]+):)?(\/\/(?P<authority>[^\/?#]*))?(?P<path>[^?#]*)(\?(?P<query>[^#]*))?(#(?P<fragment>.*))?$/', $iri, $match))
                                      {
                              Severity: Minor
                              Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/IRI.php - About 1 hr to fix

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

                                    public function __get($name)
                                    {
                                        // isset() returns false for null, we don't want to do that
                                        // Also why we use array_key_exists below instead of isset()
                                        $props = get_object_vars($this);
                                Severity: Minor
                                Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/IRI.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 get_iauthority has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    protected function get_iauthority()
                                    {
                                        if ($this->iuserinfo !== null || $this->ihost !== null || $this->port !== null)
                                        {
                                            $iauthority = '';
                                Severity: Minor
                                Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/IRI.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 get_iri has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function get_iri()
                                    {
                                        if (!$this->is_valid())
                                        {
                                            return false;
                                Severity: Minor
                                Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/IRI.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

                                Consider simplifying this complex logical expression.
                                Open

                                        if (method_exists($this, 'set_' . $name))
                                        {
                                            call_user_func(array($this, 'set_' . $name), $value);
                                        }
                                        elseif (
                                Severity: Major
                                Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/IRI.php - About 40 mins to fix

                                  Consider simplifying this complex logical expression.
                                  Open

                                          if (
                                              $name === 'iri' ||
                                              $name === 'uri' ||
                                              $name === 'iauthority' ||
                                              $name === 'authority'
                                  Severity: Major
                                  Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/IRI.php - About 40 mins to fix

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

                                        public function set_iri($iri)
                                        {
                                            static $cache;
                                            if (!$cache)
                                            {
                                    Severity: Minor
                                    Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/IRI.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 scheme_normalization has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        protected function scheme_normalization()
                                        {
                                            if (isset($this->normalization[$this->scheme]['iuserinfo']) && $this->iuserinfo === $this->normalization[$this->scheme]['iuserinfo'])
                                            {
                                                $this->iuserinfo = null;
                                    Severity: Minor
                                    Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/IRI.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

                                    There are no issues that match your filters.

                                    Category
                                    Status