WordPress/WordPress

View on GitHub
wp-includes/SimplePie/Source.php

Summary

Maintainability
F
1 mo
Test Coverage

File Source.php has 474 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * SimplePie
 *
 * A PHP-Based RSS and Atom Feed Framework.
Severity: Minor
Found in wp-includes/SimplePie/Source.php - About 7 hrs to fix

    Function get_links has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

        public function get_links($rel = 'alternate')
        {
            if (!isset($this->data['links']))
            {
                $this->data['links'] = array();
    Severity: Minor
    Found in wp-includes/SimplePie/Source.php - About 5 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 get_authors has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

        public function get_authors()
        {
            $authors = array();
            foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author)
            {
    Severity: Minor
    Found in wp-includes/SimplePie/Source.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 get_contributors has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        public function get_contributors()
        {
            $contributors = array();
            foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor)
            {
    Severity: Minor
    Found in wp-includes/SimplePie/Source.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 get_links has 64 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function get_links($rel = 'alternate')
        {
            if (!isset($this->data['links']))
            {
                $this->data['links'] = array();
    Severity: Major
    Found in wp-includes/SimplePie/Source.php - About 2 hrs to fix

      SimplePie_Source has 23 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class SimplePie_Source
      {
          var $item;
          var $data = array();
          protected $registry;
      Severity: Minor
      Found in wp-includes/SimplePie/Source.php - About 2 hrs to fix

        Method get_authors has 62 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function get_authors()
            {
                $authors = array();
                foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author)
                {
        Severity: Major
        Found in wp-includes/SimplePie/Source.php - About 2 hrs to fix

          Method get_contributors has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function get_contributors()
              {
                  $contributors = array();
                  foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor)
                  {
          Severity: Minor
          Found in wp-includes/SimplePie/Source.php - About 2 hrs to fix

            Method get_categories has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function get_categories()
                {
                    $categories = array();
            
                    foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category)
            Severity: Minor
            Found in wp-includes/SimplePie/Source.php - About 1 hr to fix

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

                  public function get_categories()
                  {
                      $categories = array();
              
                      foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category)
              Severity: Minor
              Found in wp-includes/SimplePie/Source.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 get_description has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function get_description()
                  {
                      if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle'))
                      {
                          return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
              Severity: Minor
              Found in wp-includes/SimplePie/Source.php - About 1 hr to fix

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

                    public function get_title()
                    {
                        if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
                        {
                            return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
                Severity: Minor
                Found in wp-includes/SimplePie/Source.php - About 1 hr to fix

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

                      public function get_description()
                      {
                          if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle'))
                          {
                              return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
                  Severity: Minor
                  Found in wp-includes/SimplePie/Source.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_title has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function get_title()
                      {
                          if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
                          {
                              return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
                  Severity: Minor
                  Found in wp-includes/SimplePie/Source.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

                  Avoid too many return statements within this method.
                  Open

                          return null;
                  Severity: Major
                  Found in wp-includes/SimplePie/Source.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
                    Severity: Major
                    Found in wp-includes/SimplePie/Source.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
                      Severity: Major
                      Found in wp-includes/SimplePie/Source.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                    return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
                        Severity: Major
                        Found in wp-includes/SimplePie/Source.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                      return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
                          Severity: Major
                          Found in wp-includes/SimplePie/Source.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                    return null;
                            Severity: Major
                            Found in wp-includes/SimplePie/Source.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                          return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
                              Severity: Major
                              Found in wp-includes/SimplePie/Source.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                            return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
                                Severity: Major
                                Found in wp-includes/SimplePie/Source.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                          return null;
                                  Severity: Major
                                  Found in wp-includes/SimplePie/Source.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                                return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
                                    Severity: Major
                                    Found in wp-includes/SimplePie/Source.php - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                                  return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
                                      Severity: Major
                                      Found in wp-includes/SimplePie/Source.php - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                return null;
                                        Severity: Major
                                        Found in wp-includes/SimplePie/Source.php - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                      return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
                                          Severity: Major
                                          Found in wp-includes/SimplePie/Source.php - About 30 mins to fix

                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                            Open

                                                public function get_authors()
                                                {
                                                    $authors = array();
                                                    foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author)
                                                    {
                                            Severity: Major
                                            Found in wp-includes/SimplePie/Source.php and 1 other location - About 5 days to fix
                                            wp-includes/class-simplepie.php on lines 2428..2494

                                            Duplicated Code

                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                            Tuning

                                            This issue has a mass of 998.

                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                            Refactorings

                                            Further Reading

                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                            Open

                                                    if (!isset($this->data['links']))
                                                    {
                                                        $this->data['links'] = array();
                                                        if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link'))
                                                        {
                                            Severity: Major
                                            Found in wp-includes/SimplePie/Source.php and 1 other location - About 4 days to fix
                                            wp-includes/class-simplepie.php on lines 2624..2684

                                            Duplicated Code

                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                            Tuning

                                            This issue has a mass of 822.

                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                            Refactorings

                                            Further Reading

                                            Similar blocks of code found in 3 locations. Consider refactoring.
                                            Open

                                                public function get_contributors()
                                                {
                                                    $contributors = array();
                                                    foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor)
                                                    {
                                            Severity: Major
                                            Found in wp-includes/SimplePie/Source.php and 2 other locations - About 4 days to fix
                                            wp-includes/SimplePie/Item.php on lines 562..616
                                            wp-includes/class-simplepie.php on lines 2522..2576

                                            Duplicated Code

                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                            Tuning

                                            This issue has a mass of 753.

                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                            Refactorings

                                            Further Reading

                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                            Open

                                                public function get_categories()
                                                {
                                                    $categories = array();
                                            
                                                    foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category)
                                            Severity: Major
                                            Found in wp-includes/SimplePie/Source.php and 1 other location - About 2 days to fix
                                            wp-includes/class-simplepie.php on lines 2347..2400

                                            Duplicated Code

                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                            Tuning

                                            This issue has a mass of 550.

                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                            Refactorings

                                            Further Reading

                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                            Open

                                                public function get_description()
                                                {
                                                    if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle'))
                                                    {
                                                        return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
                                            Severity: Major
                                            Found in wp-includes/SimplePie/Source.php and 1 other location - About 2 days to fix
                                            wp-includes/class-simplepie.php on lines 2720..2760

                                            Duplicated Code

                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                            Tuning

                                            This issue has a mass of 535.

                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                            Refactorings

                                            Further Reading

                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                            Open

                                                public function get_title()
                                                {
                                                    if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
                                                    {
                                                        return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
                                            Severity: Major
                                            Found in wp-includes/SimplePie/Source.php and 1 other location - About 2 days to fix
                                            wp-includes/class-simplepie.php on lines 2287..2319

                                            Duplicated Code

                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                            Tuning

                                            This issue has a mass of 423.

                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                            Refactorings

                                            Further Reading

                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                            Open

                                                public function get_copyright()
                                                {
                                                    if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights'))
                                                    {
                                                        return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
                                            Severity: Major
                                            Found in wp-includes/SimplePie/Source.php and 1 other location - About 1 day to fix
                                            wp-includes/class-simplepie.php on lines 2770..2794

                                            Duplicated Code

                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                            Tuning

                                            This issue has a mass of 298.

                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                            Refactorings

                                            Further Reading

                                            Similar blocks of code found in 3 locations. Consider refactoring.
                                            Open

                                                public function get_longitude()
                                                {
                                                    if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long'))
                                                    {
                                                        return (float) $return[0]['data'];
                                            Severity: Major
                                            Found in wp-includes/SimplePie/Source.php and 2 other locations - About 2 hrs to fix
                                            wp-includes/SimplePie/Item.php on lines 2934..2950
                                            wp-includes/class-simplepie.php on lines 2877..2893

                                            Duplicated Code

                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                            Tuning

                                            This issue has a mass of 138.

                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                            Refactorings

                                            Further Reading

                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                            Open

                                                    if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'image'))
                                                    {
                                                        return $this->sanitize($return[0]['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI);
                                                    }
                                                    elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo'))
                                            Severity: Major
                                            Found in wp-includes/SimplePie/Source.php and 1 other location - About 1 hr to fix
                                            wp-includes/class-simplepie.php on lines 2985..2996

                                            Duplicated Code

                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                            Tuning

                                            This issue has a mass of 113.

                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                            Refactorings

                                            Further Reading

                                            Similar blocks of code found in 3 locations. Consider refactoring.
                                            Open

                                                public function get_latitude()
                                                {
                                                    if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat'))
                                                    {
                                                        return (float) $return[0]['data'];
                                            Severity: Major
                                            Found in wp-includes/SimplePie/Source.php and 2 other locations - About 1 hr to fix
                                            wp-includes/SimplePie/Item.php on lines 2908..2920
                                            wp-includes/class-simplepie.php on lines 2850..2863

                                            Duplicated Code

                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                            Tuning

                                            This issue has a mass of 105.

                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                            Refactorings

                                            Further Reading

                                            There are no issues that match your filters.

                                            Category
                                            Status