CaffGeek/MBACNationals

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

Summary

Maintainability
F
1 wk
Test Coverage

File Enclosure.php has 816 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/Enclosure.php - About 1 day to fix

    Function embed has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring.
    Open

        public function embed($options = '', $native = false)
        {
            // Set up defaults
            $audio = '';
            $video = '';
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/Enclosure.php - About 1 day 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 embed has 188 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function embed($options = '', $native = false)
        {
            // Set up defaults
            $audio = '';
            $video = '';
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/Enclosure.php - About 7 hrs to fix

      Method get_real_type has 141 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function get_real_type($find_handler = false)
          {
              // Mime-types by handler.
              $types_flash = array('application/x-shockwave-flash', 'application/futuresplash'); // Flash
              $types_fmedia = array('video/flv', 'video/x-flv','flv-application/octet-stream'); // Flash Media Player
      Severity: Major
      Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/Enclosure.php - About 5 hrs to fix

        SimplePie_Enclosure has 41 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class SimplePie_Enclosure
        {
            /**
             * @var string
             * @see get_bitrate()
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/Enclosure.php - About 5 hrs to fix

          Function get_real_type has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
          Open

              public function get_real_type($find_handler = false)
              {
                  // Mime-types by handler.
                  $types_flash = array('application/x-shockwave-flash', 'application/futuresplash'); // Flash
                  $types_fmedia = array('video/flv', 'video/x-flv','flv-application/octet-stream'); // Flash Media Player
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/Enclosure.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

          Method __construct has 26 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function __construct($link = null, $type = null, $length = null, $javascript = null, $bitrate = null, $captions = null, $categories = null, $channels = null, $copyright = null, $credits = null, $description = null, $duration = null, $expression = null, $framerate = null, $hashes = null, $height = null, $keywords = null, $lang = null, $medium = null, $player = null, $ratings = null, $restrictions = null, $samplingrate = null, $thumbnails = null, $title = null, $width = null)
          Severity: Major
          Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/Enclosure.php - About 3 hrs to fix

            Method __construct has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function __construct($link = null, $type = null, $length = null, $javascript = null, $bitrate = null, $captions = null, $categories = null, $channels = null, $copyright = null, $credits = null, $description = null, $duration = null, $expression = null, $framerate = null, $hashes = null, $height = null, $keywords = null, $lang = null, $medium = null, $player = null, $ratings = null, $restrictions = null, $samplingrate = null, $thumbnails = null, $title = null, $width = null)
                {
                    $this->bitrate = $bitrate;
                    $this->captions = $captions;
                    $this->categories = $categories;
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/Enclosure.php - About 1 hr to fix

              Avoid too many return statements within this method.
              Open

                              return null;
              Severity: Major
              Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/Enclosure.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                return 'mp3';
                Severity: Major
                Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/Enclosure.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return $type;
                  Severity: Major
                  Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/Enclosure.php - About 30 mins to fix

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

                            if (!in_array($type, array_merge($types_flash, $types_fmedia, $types_quicktime, $types_wmedia, $types_mp3)))
                            {
                                switch (strtolower($this->get_extension()))
                                {
                                    // Audio mime-types
                    Severity: Major
                    Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/Enclosure.php and 1 other location - About 2 days to fix
                    Web.Admin/2014/wordpress/wp-includes/class-simplepie.php on lines 7188..7309

                    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 414.

                    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

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

                            if (is_array($options))
                            {
                                extract($options);
                            }
                            else
                    Severity: Major
                    Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/Enclosure.php and 1 other location - About 1 day to fix
                    Web.Admin/2014/wordpress/wp-includes/class-simplepie.php on lines 6932..6990

                    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 296.

                    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

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

                        public function __construct($link = null, $type = null, $length = null, $javascript = null, $bitrate = null, $captions = null, $categories = null, $channels = null, $copyright = null, $credits = null, $description = null, $duration = null, $expression = null, $framerate = null, $hashes = null, $height = null, $keywords = null, $lang = null, $medium = null, $player = null, $ratings = null, $restrictions = null, $samplingrate = null, $thumbnails = null, $title = null, $width = null)
                        {
                            $this->bitrate = $bitrate;
                            $this->captions = $captions;
                            $this->categories = $categories;
                    Severity: Major
                    Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/Enclosure.php and 1 other location - About 7 hrs to fix
                    Web.Admin/2014/wordpress/wp-includes/class-simplepie.php on lines 6421..6456

                    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 235.

                    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

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

                            if ($height === 'auto')
                            {
                                if ($mime === 'audio')
                                {
                                    $height = 0;
                    Severity: Major
                    Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/Enclosure.php and 1 other location - About 3 hrs to fix
                    Web.Admin/2014/wordpress/wp-includes/class-simplepie.php on lines 7019..7055

                    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 154.

                    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

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

                            elseif ($handler === 'quicktime' || ($handler === 'mp3' && $mediaplayer === ''))
                            {
                                $height += 16;
                                if ($native)
                                {
                    Severity: Major
                    Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/Enclosure.php and 1 other location - About 3 hrs to fix
                    Web.Admin/2014/wordpress/wp-includes/class-simplepie.php on lines 7123..7141

                    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 151.

                    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

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

                            elseif ($handler === 'fmedia' || ($handler === 'mp3' && $mediaplayer !== ''))
                            {
                                $height += 20;
                                if ($native)
                                {
                    Severity: Major
                    Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/Enclosure.php and 1 other location - About 2 hrs to fix
                    Web.Admin/2014/wordpress/wp-includes/class-simplepie.php on lines 7108..7119

                    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 137.

                    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

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

                            if ($width === 'auto')
                            {
                                if ($mime === 'video')
                                {
                                    if ($height === 'auto')
                    Web.Admin/2014/wordpress/wp-includes/class-simplepie.php on lines 6996..7017

                    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 109.

                    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

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

                            if ($find_handler)
                            {
                                if (in_array($type, $types_flash))
                                {
                                    return 'flash';
                    Web.Admin/2014/wordpress/wp-includes/class-simplepie.php on lines 7311..7341

                    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 106.

                    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