railpage/railpagecore

View on GitHub
lib/Formatting/MultimediaUtility.php

Summary

Maintainability
F
3 days
Test Coverage

The class MultimediaUtility has an overall complexity of 53 which is very high. The configured complexity threshold is 50.
Open

class MultimediaUtility {
    
    /**
     * Find links in our string and attempt to process those
     * @since Version 3.10.0
Severity: Minor
Found in lib/Formatting/MultimediaUtility.php by phpmd

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

    public static function EmbedGoogleMap(DOMElement $e) {
        
        $timer = Debug::GetTimer(); 
        
        $Config = AppCore::GetConfig(); 
Severity: Minor
Found in lib/Formatting/MultimediaUtility.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

File MultimediaUtility.php has 265 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Multimedia formatter
 * @since Version 3.10.0
Severity: Minor
Found in lib/Formatting/MultimediaUtility.php - About 2 hrs to fix

    Method EmbedGoogleMap has 54 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function EmbedGoogleMap(DOMElement $e) {
            
            $timer = Debug::GetTimer(); 
            
            $Config = AppCore::GetConfig(); 
    Severity: Major
    Found in lib/Formatting/MultimediaUtility.php - About 2 hrs to fix

      Method embedRailpageDownload has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private static function embedRailpageDownload($e) {
              
              if (pq($e)->attr("href") != pq($e)->text()) {
                  return $e;
              }
      Severity: Minor
      Found in lib/Formatting/MultimediaUtility.php - About 1 hr to fix

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

            public static function EmbedFlickrPhoto(DOMElement $e) {
                
                if (!(preg_match("@:\/\/flic.kr/p/([a-zA-Z0-9]+)@", pq($e)->attr("href"), $matches)) && 
                    !preg_match("@:\/\/www.flickr.com\/photos\/([a-zA-Z0-9\@]+)\/([0-9]+)@", pq($e)->attr("href"), $matches)) {
                        return $e; 
        Severity: Minor
        Found in lib/Formatting/MultimediaUtility.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 embedRailpageDownload has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            private static function embedRailpageDownload($e) {
                
                if (pq($e)->attr("href") != pq($e)->text()) {
                    return $e;
                }
        Severity: Minor
        Found in lib/Formatting/MultimediaUtility.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

        Avoid too many return statements within this method.
        Open

                    return self::EmbedGoogleMap($e);
        Severity: Major
        Found in lib/Formatting/MultimediaUtility.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return $e;
          Severity: Major
          Found in lib/Formatting/MultimediaUtility.php - About 30 mins to fix

            The method EmbedGoogleMap() has an NPath complexity of 294. The configured NPath complexity threshold is 200.
            Open

                public static function EmbedGoogleMap(DOMElement $e) {
                    
                    $timer = Debug::GetTimer(); 
                    
                    $Config = AppCore::GetConfig(); 
            Severity: Minor
            Found in lib/Formatting/MultimediaUtility.php by phpmd

            NPathComplexity

            Since: 0.1

            The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

            Example

            class Foo {
                function bar() {
                    // lots of complicated code
                }
            }

            Source https://phpmd.org/rules/codesize.html#npathcomplexity

            The method EmbedGoogleMap() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
            Open

                public static function EmbedGoogleMap(DOMElement $e) {
                    
                    $timer = Debug::GetTimer(); 
                    
                    $Config = AppCore::GetConfig(); 
            Severity: Minor
            Found in lib/Formatting/MultimediaUtility.php by phpmd

            CyclomaticComplexity

            Since: 0.1

            Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

            Example

            // Cyclomatic Complexity = 11
            class Foo {
            1   public function example() {
            2       if ($a == $b) {
            3           if ($a1 == $b1) {
                            fiddle();
            4           } elseif ($a2 == $b2) {
                            fiddle();
                        } else {
                            fiddle();
                        }
            5       } elseif ($c == $d) {
            6           while ($c == $d) {
                            fiddle();
                        }
            7        } elseif ($e == $f) {
            8           for ($n = 0; $n < $h; $n++) {
                            fiddle();
                        }
                    } else {
                        switch ($z) {
            9               case 1:
                                fiddle();
                                break;
            10              case 2:
                                fiddle();
                                break;
            11              case 3:
                                fiddle();
                                break;
                            default:
                                fiddle();
                                break;
                        }
                    }
                }
            }

            Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

            Avoid unused local variables such as '$matches'.
            Open

                    if (!preg_match("#:\/\/www.flickr.com\/photos\/([a-zA-Z0-9\@]+)\/\z#", pq($e)->attr("href"), $matches)) {
            Severity: Minor
            Found in lib/Formatting/MultimediaUtility.php by phpmd

            UnusedLocalVariable

            Since: 0.2

            Detects when a local variable is declared and/or assigned, but not used.

            Example

            class Foo {
                public function doSomething()
                {
                    $i = 5; // Unused
                }
            }

            Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

            Avoid unused local variables such as '$matches'.
            Open

                    if (!preg_match("#:\/\/www.flickr.com\/photos\/([a-zA-Z0-9\@]+)\/(sets|albums)\/([a-zA-Z0-9\@]+)\z#", pq($e)->attr("href"), $matches)) {
            Severity: Minor
            Found in lib/Formatting/MultimediaUtility.php by phpmd

            UnusedLocalVariable

            Since: 0.2

            Detects when a local variable is declared and/or assigned, but not used.

            Example

            class Foo {
                public function doSomething()
                {
                    $i = 5; // Unused
                }
            }

            Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

            Avoid unused parameters such as '$group'.
            Open

                private static function drawFlickrFromOpenGraph(DOMElement $e, $group = null) {
            Severity: Minor
            Found in lib/Formatting/MultimediaUtility.php by phpmd

            UnusedFormalParameter

            Since: 0.2

            Avoid passing parameters to methods or constructors and then not using those parameters.

            Example

            class Foo
            {
                private function bar($howdy)
                {
                    // $howdy is not used
                }
            }

            Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

            Avoid unused local variables such as '$matches'.
            Open

                    if (!preg_match("/(?:https?:\/\/)?(?:www\.)?youtu\.?be(?:\.com)?\/?.*(?:watch|embed)?(?:.*v=|v\/|\/)([\w\-_]+)\&?/", pq($e)->attr("href"), $matches)) {
            Severity: Minor
            Found in lib/Formatting/MultimediaUtility.php by phpmd

            UnusedLocalVariable

            Since: 0.2

            Detects when a local variable is declared and/or assigned, but not used.

            Example

            class Foo {
                public function doSomething()
                {
                    $i = 5; // Unused
                }
            }

            Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

            Avoid assigning values to variables in if clauses and the like (line '102', column '13').
            Open

                private static function embedRailpageDownload($e) {
                    
                    if (pq($e)->attr("href") != pq($e)->text()) {
                        return $e;
                    }
            Severity: Minor
            Found in lib/Formatting/MultimediaUtility.php by phpmd

            IfStatementAssignment

            Since: 2.7.0

            Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

            Example

            class Foo
            {
                public function bar($flag)
                {
                    if ($foo = 'bar') { // possible typo
                        // ...
                    }
                    if ($baz = 0) { // always false
                        // ...
                    }
                }
            }

            Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

            Avoid assigning values to variables in if clauses and the like (line '514', column '18').
            Open

                public static function EmbedGoogleMap(DOMElement $e) {
                    
                    $timer = Debug::GetTimer(); 
                    
                    $Config = AppCore::GetConfig(); 
            Severity: Minor
            Found in lib/Formatting/MultimediaUtility.php by phpmd

            IfStatementAssignment

            Since: 2.7.0

            Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

            Example

            class Foo
            {
                public function bar($flag)
                {
                    if ($foo = 'bar') { // possible typo
                        // ...
                    }
                    if ($baz = 0) { // always false
                        // ...
                    }
                }
            }

            Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

            Avoid assigning values to variables in if clauses and the like (line '128', column '13').
            Open

                private static function embedRailpageDownload($e) {
                    
                    if (pq($e)->attr("href") != pq($e)->text()) {
                        return $e;
                    }
            Severity: Minor
            Found in lib/Formatting/MultimediaUtility.php by phpmd

            IfStatementAssignment

            Since: 2.7.0

            Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

            Example

            class Foo
            {
                public function bar($flag)
                {
                    if ($foo = 'bar') { // possible typo
                        // ...
                    }
                    if ($baz = 0) { // always false
                        // ...
                    }
                }
            }

            Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

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

                public static function EmbedFlickrAlbum(DOMElement $e) {
                    
                    if (!preg_match("#:\/\/www.flickr.com\/photos\/([a-zA-Z0-9\@]+)\/(sets|albums)\/([a-zA-Z0-9\@]+)\z#", pq($e)->attr("href"), $matches)) {
                        return $e; 
                    }
            Severity: Major
            Found in lib/Formatting/MultimediaUtility.php and 1 other location - About 2 hrs to fix
            lib/Formatting/MultimediaUtility.php on lines 294..312

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

            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 static function EmbedFlickrPhotostream(DOMElement $e) {
                                
                    if (!preg_match("#:\/\/www.flickr.com\/photos\/([a-zA-Z0-9\@]+)\/\z#", pq($e)->attr("href"), $matches)) {
                        return $e; 
                    }
            Severity: Major
            Found in lib/Formatting/MultimediaUtility.php and 1 other location - About 2 hrs to fix
            lib/Formatting/MultimediaUtility.php on lines 322..340

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

            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 6 locations. Consider refactoring.
            Open

                    $find = [
                        "<p>%0A</p>",
                        "<p>",
                        "</p>",
                        "%0A",
            Severity: Major
            Found in lib/Formatting/MultimediaUtility.php and 5 other locations - About 55 mins to fix
            lib/Events/Month.php on lines 151..151
            lib/Formatting/BbcodeUtility.php on lines 89..97
            lib/Formatting/BbcodeUtility.php on lines 99..107
            lib/Locos/Liveries/Livery.php on lines 297..297
            lib/Locos/Locomotive.php on lines 400..400

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

            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

                            $video->append('<source src="/uploads/' . $row['file'] . '" type="' . $row['mime'] . '">');
            Severity: Minor
            Found in lib/Formatting/MultimediaUtility.php and 1 other location - About 55 mins to fix
            lib/Newsletters/Weekly.php on lines 348..348

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

            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 8 locations. Consider refactoring.
            Open

            if (!defined("RP_HOST")) {
                define("RP_HOST", "www.railpage.com.au"); 
            }
            Severity: Major
            Found in lib/Formatting/MultimediaUtility.php and 7 other locations - About 50 mins to fix
            lib/Users/User.php on lines 1346..1348
            lib/AppCore.php on lines 38..40
            lib/AppCore.php on lines 42..44
            lib/AppCore.php on lines 46..48
            lib/Module.php on lines 18..20
            lib/Session.php on lines 70..72
            lib/Template_Cache_Memcache.php on lines 17..19

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

            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

                    $replace = array_fill(0, count($find), ""); 
            Severity: Minor
            Found in lib/Formatting/MultimediaUtility.php and 1 other location - About 50 mins to fix
            lib/AppCore.php on lines 698..698

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

            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 4 locations. Consider refactoring.
            Open

                    if (is_string($string)) {
                        $string = phpQuery::newDocumentHTML($string);
                    }
            Severity: Major
            Found in lib/Formatting/MultimediaUtility.php and 3 other locations - About 45 mins to fix
            lib/Formatting/EmoticonsUtility.php on lines 43..45
            lib/Formatting/Html.php on lines 30..32
            lib/Formatting/Html.php on lines 101..103

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

            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

                    $return['v'] = trim(str_replace("</p>", "", $return['v'])); 
            Severity: Minor
            Found in lib/Formatting/MultimediaUtility.php and 1 other location - About 45 mins to fix
            lib/Images/Provider/Flickr.php on lines 679..679

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

            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 (preg_match("@:\/\/flic.kr/p/([a-zA-Z0-9]+)@", pq($next)->attr("href")) || preg_match("@:\/\/www.flickr.com\/photos\/([a-zA-Z0-9\@]+)\/([0-9]+)@", pq($next)->attr("href"), $matches)) {
            Severity: Minor
            Found in lib/Formatting/MultimediaUtility.php and 1 other location - About 40 mins to fix
            lib/Formatting/MultimediaUtility.php on lines 351..351

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

            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 (!preg_match("/www.flickr.com\/groups\/([a-zA-Z0-9\@]+)[\/]?/", pq($e)->attr("href"))) {
            Severity: Minor
            Found in lib/Formatting/MultimediaUtility.php and 1 other location - About 40 mins to fix
            lib/Formatting/MultimediaUtility.php on lines 217..217

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

            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 15 locations. Consider refactoring.
            Open

                    $og['title'] = ContentUtility::FormatTitle($og['title']); 
            Severity: Major
            Found in lib/Formatting/MultimediaUtility.php and 14 other locations - About 35 mins to fix
            lib/Images/Competition.php on lines 351..351
            lib/Images/Exif.php on lines 145..145
            lib/Images/Exif.php on lines 146..146
            lib/Images/Exif.php on lines 147..147
            lib/Images/ImageFactory.php on lines 229..229
            lib/Images/Utility/Finder.php on lines 706..706
            lib/Images/Utility/Finder.php on lines 735..735
            lib/Locos/Utility/LocosUtility.php on lines 56..56
            lib/News/Topic.php on lines 233..233
            lib/News/Topic.php on lines 290..290
            lib/News/Topic.php on lines 292..292
            lib/Newsletters/Weekly.php on lines 412..412
            lib/Newsletters/Weekly.php on lines 414..414
            lib/Users/Timeline.php on lines 177..177

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

            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

                    pq($e)->after("<br><br><a href='" . pq($e)->attr("href") . "'>" . pq($e)->attr("href") . "</a>")->replaceWith($video_iframe);
            Severity: Minor
            Found in lib/Formatting/MultimediaUtility.php and 1 other location - About 35 mins to fix
            lib/Formatting/MultimediaUtility.php on lines 99..99

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

            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

                    $block->append("<p>" . pq($e)->attr("href") . "</p>");
            Severity: Minor
            Found in lib/Formatting/MultimediaUtility.php and 1 other location - About 35 mins to fix
            lib/Formatting/MultimediaUtility.php on lines 414..414

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

            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

                        pq($e)->attr("href", self::fixCrappyUrls(pq($e)->attr("href"))); 
            Severity: Minor
            Found in lib/Formatting/MultimediaUtility.php and 1 other location - About 30 mins to fix
            lib/Formatting/MultimediaUtility.php on lines 241..241

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

            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

                    $og = ContentUtility::GetOpenGraphTags(pq($e)->attr("href")); 
            Severity: Minor
            Found in lib/Formatting/MultimediaUtility.php and 1 other location - About 30 mins to fix
            lib/Formatting/MultimediaUtility.php on lines 58..58

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

            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

                    $block->append("<p>" . nl2br($Download->desc) . "</p>"); 
            Severity: Minor
            Found in lib/Formatting/MultimediaUtility.php and 1 other location - About 30 mins to fix
            lib/Newsletters/Weekly.php on lines 331..331

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

            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 9 locations. Consider refactoring.
            Open

                    $lookup = pq($e)->attr("href"); 
            Severity: Major
            Found in lib/Formatting/MultimediaUtility.php and 8 other locations - About 30 mins to fix
            lib/Formatting/Html.php on lines 47..47
            lib/Formatting/Html.php on lines 50..50
            lib/Formatting/Html.php on lines 51..51
            lib/Formatting/Html.php on lines 52..52
            lib/Formatting/MultimediaUtility.php on lines 355..355
            lib/Formatting/MultimediaUtility.php on lines 433..433
            lib/ContentUtility.php on lines 362..362
            lib/Url.php on lines 163..163

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

            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 9 locations. Consider refactoring.
            Open

                    $href = pq($e)->attr("href");
            Severity: Major
            Found in lib/Formatting/MultimediaUtility.php and 8 other locations - About 30 mins to fix
            lib/Formatting/Html.php on lines 47..47
            lib/Formatting/Html.php on lines 50..50
            lib/Formatting/Html.php on lines 51..51
            lib/Formatting/Html.php on lines 52..52
            lib/Formatting/MultimediaUtility.php on lines 433..433
            lib/Formatting/MultimediaUtility.php on lines 470..470
            lib/ContentUtility.php on lines 362..362
            lib/Url.php on lines 163..163

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

            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 9 locations. Consider refactoring.
            Open

                    $url = pq($e)->attr("href"); 
            Severity: Major
            Found in lib/Formatting/MultimediaUtility.php and 8 other locations - About 30 mins to fix
            lib/Formatting/Html.php on lines 47..47
            lib/Formatting/Html.php on lines 50..50
            lib/Formatting/Html.php on lines 51..51
            lib/Formatting/Html.php on lines 52..52
            lib/Formatting/MultimediaUtility.php on lines 355..355
            lib/Formatting/MultimediaUtility.php on lines 470..470
            lib/ContentUtility.php on lines 362..362
            lib/Url.php on lines 163..163

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

            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 8 locations. Consider refactoring.
            Open

                    $string = str_replace($find, $replace, $string); 
            Severity: Major
            Found in lib/Formatting/MultimediaUtility.php and 7 other locations - About 30 mins to fix
            lib/Formatting/BbcodeUtility.php on lines 109..109
            lib/Formatting/BbcodeUtility.php on lines 124..124
            lib/Images/Exif.php on lines 230..230
            lib/Links/Links.php on lines 305..305
            lib/News/Base.php on lines 347..347
            lib/News/Utility/ArticleUtility.php on lines 97..97
            lib/AppCore.php on lines 700..700

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

            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

                        !preg_match("#goo.gl/maps/([a-zA-Z0-9]{10,13})#", $lookup, $matches[1])) {
            Severity: Minor
            Found in lib/Formatting/MultimediaUtility.php and 1 other location - About 30 mins to fix
            lib/Formatting/MultimediaUtility.php on lines 477..477

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

            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 (!preg_match("#google.com(.au)?/maps/(.*)\@([0-9\-.]{8,13}),([0-9\-.]{8,13})#", $lookup, $matches[0]) &&
            Severity: Minor
            Found in lib/Formatting/MultimediaUtility.php and 1 other location - About 30 mins to fix
            lib/Formatting/MultimediaUtility.php on lines 478..478

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

            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

            Function closing brace must go on the next line following the body; found 1 blank lines before brace
            Open

                }

            Function closing brace must go on the next line following the body; found 1 blank lines before brace
            Open

                }

            Function closing brace must go on the next line following the body; found 1 blank lines before brace
            Open

                }

            Function closing brace must go on the next line following the body; found 1 blank lines before brace
            Open

                }

            Function closing brace must go on the next line following the body; found 1 blank lines before brace
            Open

                }

            Blank line found at end of control structure
            Open

                        

            Blank line found at start of control structure
            Open

                        if (!$return = $Memcached->fetch($cachekey)) {

            Function closing brace must go on the next line following the body; found 1 blank lines before brace
            Open

                }

            Function closing brace must go on the next line following the body; found 1 blank lines before brace
            Open

                }

            Blank line found at start of control structure
            Open

                    foreach (pq('a') as $e) {

            Blank line found at end of control structure
            Open

                            

            Blank line found at start of control structure
            Open

                    foreach (pq(".embed-group-member") as $e) {

            Function closing brace must go on the next line following the body; found 1 blank lines before brace
            Open

                }

            Blank line found at end of control structure
            Open

                        

            Blank line found at end of control structure
            Open

                        

            Blank line found at start of control structure
            Open

                    foreach (pq($e)->next() as $next) {

            Blank line found at start of control structure
            Open

                    if ($thumb = $Download->getThumbnail()) {

            Spaces must be used to indent lines; tabs are not allowed
            Open

                                

            Spaces must be used to indent lines; tabs are not allowed
            Open

                        

            There are no issues that match your filters.

            Category
            Status