modxcms/revolution

View on GitHub
core/model/phpthumb/phpthumb.class.php

Summary

Maintainability
F
2 mos
Test Coverage

Function ImageMagickThumbnailToGD has a Cognitive Complexity of 570 (exceeds 5 allowed). Consider refactoring.
Open

    public function ImageMagickThumbnailToGD() {
        // http://www.imagemagick.org/script/command-line-options.php

        $this->useRawIMoutput = true;
        if (phpthumb_functions::gd_version()) {
Severity: Minor
Found in core/model/phpthumb/phpthumb.class.php - About 1 wk 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 phpthumb.class.php has 3768 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
//////////////////////////////////////////////////////////////
//   phpThumb() by James Heinrich <info@silisoftware.com>   //
//        available at http://phpthumb.sourceforge.net      //
//         and/or https://github.com/JamesHeinrich/phpThumb //
Severity: Major
Found in core/model/phpthumb/phpthumb.class.php - About 1 wk to fix

    Function ApplyFilters has a Cognitive Complexity of 241 (exceeds 5 allowed). Consider refactoring.
    Open

        public function ApplyFilters() {
            if ($this->fltr && is_array($this->fltr)) {
                if (!include_once __DIR__ .'/phpthumb.filters.php' ) {
                    $this->DebugMessage('Error including "'. __DIR__ .'/phpthumb.filters.php" which is required for applying filters ('.implode(';', $this->fltr).')', __FILE__, __LINE__);
                    return false;
    Severity: Minor
    Found in core/model/phpthumb/phpthumb.class.php - About 4 days 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 ImageMagickThumbnailToGD has 652 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function ImageMagickThumbnailToGD() {
            // http://www.imagemagick.org/script/command-line-options.php
    
            $this->useRawIMoutput = true;
            if (phpthumb_functions::gd_version()) {
    Severity: Major
    Found in core/model/phpthumb/phpthumb.class.php - About 3 days to fix

      Function SourceImageToGD has a Cognitive Complexity of 139 (exceeds 5 allowed). Consider refactoring.
      Open

          public function SourceImageToGD() {
              if (is_resource($this->gdimg_source) || (is_object($this->gdimg_source) && $this->gdimg_source instanceOf \GdImage)) {
                  $this->source_width  = imagesx($this->gdimg_source);
                  $this->source_height = imagesy($this->gdimg_source);
                  $this->DebugMessage('skipping SourceImageToGD() because $this->gdimg_source is already a resource ('.$this->source_width.'x'.$this->source_height.')', __FILE__, __LINE__);
      Severity: Minor
      Found in core/model/phpthumb/phpthumb.class.php - About 2 days 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 CleanUpCacheDirectory has a Cognitive Complexity of 107 (exceeds 5 allowed). Consider refactoring.
      Open

          public function CleanUpCacheDirectory() {
              $this->DebugMessage('CleanUpCacheDirectory() set to purge ('.(null === $this->config_cache_maxage ? 'NULL' : number_format($this->config_cache_maxage / 86400, 1)).' days; '.(null === $this->config_cache_maxsize ? 'NULL' : number_format($this->config_cache_maxsize / 1048576, 2)).' MB; '.(null === $this->config_cache_maxfiles ? 'NULL' : number_format($this->config_cache_maxfiles)).' files)', __FILE__, __LINE__);
      
              if (!is_writable($this->config_cache_directory)) {
                  $this->DebugMessage('CleanUpCacheDirectory() skipped because "'.$this->config_cache_directory.'" is not writable', __FILE__, __LINE__);
      Severity: Minor
      Found in core/model/phpthumb/phpthumb.class.php - About 2 days 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 ApplyFilters has 405 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function ApplyFilters() {
              if ($this->fltr && is_array($this->fltr)) {
                  if (!include_once __DIR__ .'/phpthumb.filters.php' ) {
                      $this->DebugMessage('Error including "'. __DIR__ .'/phpthumb.filters.php" which is required for applying filters ('.implode(';', $this->fltr).')', __FILE__, __LINE__);
                      return false;
      Severity: Major
      Found in core/model/phpthumb/phpthumb.class.php - About 2 days to fix

        Function ExtractEXIFgetImageSize has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring.
        Open

            public function ExtractEXIFgetImageSize() {
                $this->DebugMessage('starting ExtractEXIFgetImageSize()', __FILE__, __LINE__);
        
                if (preg_match('#^http:#i', (string)$this->src) && !$this->sourceFilename && $this->rawImageData) {
                    $this->SourceDataToTempFile();
        Severity: Minor
        Found in core/model/phpthumb/phpthumb.class.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 SourceImageToGD has 226 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function SourceImageToGD() {
                if (is_resource($this->gdimg_source) || (is_object($this->gdimg_source) && $this->gdimg_source instanceOf \GdImage)) {
                    $this->source_width  = imagesx($this->gdimg_source);
                    $this->source_height = imagesy($this->gdimg_source);
                    $this->DebugMessage('skipping SourceImageToGD() because $this->gdimg_source is already a resource ('.$this->source_width.'x'.$this->source_height.')', __FILE__, __LINE__);
        Severity: Major
        Found in core/model/phpthumb/phpthumb.class.php - About 1 day to fix

          phpthumb has 60 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class phpthumb {
          
              // public:
              // START PARAMETERS (for object mode and phpThumb.php)
              // See phpthumb.readme.txt for descriptions of what each of these values are
          Severity: Major
          Found in core/model/phpthumb/phpthumb.class.php - About 1 day to fix

            Function Rotate has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
            Open

                public function Rotate() {
                    if ($this->ra || $this->ar) {
                        if (!function_exists('imagerotate')) {
                            $this->DebugMessage('!function_exists(imagerotate)', __FILE__, __LINE__);
                            return false;
            Severity: Minor
            Found in core/model/phpthumb/phpthumb.class.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

            Function ImageCreateFromStringReplacement has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
            Open

                public function ImageCreateFromStringReplacement(&$RawImageData, $DieOnErrors=false) {
                    // there are serious bugs in the non-bundled versions of GD which may cause
                    // PHP to segfault when calling imagecreatefromstring() - avoid if at all possible
                    // when not using a bundled version of GD2
                    if (!phpthumb_functions::gd_version()) {
            Severity: Minor
            Found in core/model/phpthumb/phpthumb.class.php - About 7 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function ResolveFilenameToAbsolute has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
            Open

                public function ResolveFilenameToAbsolute($filename) {
                    if (empty($filename)) {
                        return false;
                    }
            
            
            Severity: Minor
            Found in core/model/phpthumb/phpthumb.class.php - About 6 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function OutputThumbnail has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
            Open

                public function OutputThumbnail() {
                    $this->purgeTempFiles();
            
                    if (!$this->useRawIMoutput && !(is_resource($this->gdimg_output) || (is_object($this->gdimg_source) && $this->gdimg_source instanceOf \GdImage))) {
                        $this->DebugMessage('OutputThumbnail() failed because !is_resource($this->gdimg_output)', __FILE__, __LINE__);
            Severity: Minor
            Found in core/model/phpthumb/phpthumb.class.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 AlphaChannelFlatten has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
            Open

                public function AlphaChannelFlatten() {
                    if (!$this->is_alpha) {
                        // image doesn't have alpha transparency, no need to flatten
                        $this->DebugMessage('skipping AlphaChannelFlatten() because !$this->is_alpha', __FILE__, __LINE__);
                        return false;
            Severity: Minor
            Found in core/model/phpthumb/phpthumb.class.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 CleanUpCacheDirectory has 138 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function CleanUpCacheDirectory() {
                    $this->DebugMessage('CleanUpCacheDirectory() set to purge ('.(null === $this->config_cache_maxage ? 'NULL' : number_format($this->config_cache_maxage / 86400, 1)).' days; '.(null === $this->config_cache_maxsize ? 'NULL' : number_format($this->config_cache_maxsize / 1048576, 2)).' MB; '.(null === $this->config_cache_maxfiles ? 'NULL' : number_format($this->config_cache_maxfiles)).' files)', __FILE__, __LINE__);
            
                    if (!is_writable($this->config_cache_directory)) {
                        $this->DebugMessage('CleanUpCacheDirectory() skipped because "'.$this->config_cache_directory.'" is not writable', __FILE__, __LINE__);
            Severity: Major
            Found in core/model/phpthumb/phpthumb.class.php - About 5 hrs to fix

              Method RenderOutput has 134 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function RenderOutput() {
                      if (!$this->useRawIMoutput && !(is_resource($this->gdimg_output) || (is_object($this->gdimg_source) && $this->gdimg_source instanceOf \GdImage))) {
                          $this->DebugMessage('RenderOutput() failed because !is_resource($this->gdimg_output)', __FILE__, __LINE__);
                          return false;
                      }
              Severity: Major
              Found in core/model/phpthumb/phpthumb.class.php - About 5 hrs to fix

                Method phpThumbDebug has 125 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function phpThumbDebug($level='') {
                        if ($level && ($this->phpThumbDebug !== $level)) {
                            return true;
                        }
                        if ($this->config_disable_debug) {
                Severity: Major
                Found in core/model/phpthumb/phpthumb.class.php - About 5 hrs to fix

                  Method ExtractEXIFgetImageSize has 119 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function ExtractEXIFgetImageSize() {
                          $this->DebugMessage('starting ExtractEXIFgetImageSize()', __FILE__, __LINE__);
                  
                          if (preg_match('#^http:#i', (string)$this->src) && !$this->sourceFilename && $this->rawImageData) {
                              $this->SourceDataToTempFile();
                  Severity: Major
                  Found in core/model/phpthumb/phpthumb.class.php - About 4 hrs to fix

                    Function RenderOutput has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function RenderOutput() {
                            if (!$this->useRawIMoutput && !(is_resource($this->gdimg_output) || (is_object($this->gdimg_source) && $this->gdimg_source instanceOf \GdImage))) {
                                $this->DebugMessage('RenderOutput() failed because !is_resource($this->gdimg_output)', __FILE__, __LINE__);
                                return false;
                            }
                    Severity: Minor
                    Found in core/model/phpthumb/phpthumb.class.php - About 4 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 SetCacheFilename has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function SetCacheFilename() {
                            if (null !== $this->cache_filename) {
                                $this->DebugMessage('$this->cache_filename already set, skipping SetCacheFilename()', __FILE__, __LINE__);
                                return true;
                            }
                    Severity: Minor
                    Found in core/model/phpthumb/phpthumb.class.php - About 4 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 ErrorImage has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function ErrorImage($text, $width=0, $height=0, $forcedisplay=false) {
                            $width  = ($width  ? $width  : $this->config_error_image_width);
                            $height = ($height ? $height : $this->config_error_image_height);
                    
                            $text = 'phpThumb() v'.$this->phpthumb_version."\n".'http://phpthumb.sourceforge.net'."\n\n".($this->config_disable_debug ? 'Error messages disabled.'."\n\n".'edit phpThumb.config.php and (temporarily) set'."\n".'$PHPTHUMB_CONFIG[\'disable_debug\'] = false;'."\n".'to view the details of this error' : $text);
                    Severity: Minor
                    Found in core/model/phpthumb/phpthumb.class.php - About 4 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 ImageCreateFromStringReplacement has 98 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function ImageCreateFromStringReplacement(&$RawImageData, $DieOnErrors=false) {
                            // there are serious bugs in the non-bundled versions of GD which may cause
                            // PHP to segfault when calling imagecreatefromstring() - avoid if at all possible
                            // when not using a bundled version of GD2
                            if (!phpthumb_functions::gd_version()) {
                    Severity: Major
                    Found in core/model/phpthumb/phpthumb.class.php - About 3 hrs to fix

                      Function MaxFileSize has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function MaxFileSize() {
                              if (phpthumb_functions::gd_version() < 2) {
                                  $this->DebugMessage('Skipping MaxFileSize() because gd_version is "'.phpthumb_functions::gd_version().'"', __FILE__, __LINE__);
                                  return false;
                              }
                      Severity: Minor
                      Found in core/model/phpthumb/phpthumb.class.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 setOutputFormat has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function setOutputFormat() {
                              static $alreadyCalled = false;
                              if ($this->thumbnailFormat && $alreadyCalled) {
                                  return true;
                              }
                      Severity: Minor
                      Found in core/model/phpthumb/phpthumb.class.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 AntiOffsiteLinking has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function AntiOffsiteLinking() {
                              // Optional anti-offsite hijacking of the thumbnail script
                              $allow   = true;
                              if ($allow && $this->config_nooffsitelink_enabled && (@$_SERVER['HTTP_REFERER'] || $this->config_nooffsitelink_require_refer)) {
                                  $this->DebugMessage('AntiOffsiteLinking() checking $_SERVER[HTTP_REFERER] "'.@$_SERVER['HTTP_REFERER'].'"', __FILE__, __LINE__);
                      Severity: Minor
                      Found in core/model/phpthumb/phpthumb.class.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 ImageMagickCommandlineBase has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function ImageMagickCommandlineBase() {
                              static $commandline = null;
                              if (null === $commandline) {
                                  if ($this->issafemode) {
                                      $commandline = '';
                      Severity: Minor
                      Found in core/model/phpthumb/phpthumb.class.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

                      Method OutputThumbnail has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function OutputThumbnail() {
                              $this->purgeTempFiles();
                      
                              if (!$this->useRawIMoutput && !(is_resource($this->gdimg_output) || (is_object($this->gdimg_source) && $this->gdimg_source instanceOf \GdImage))) {
                                  $this->DebugMessage('OutputThumbnail() failed because !is_resource($this->gdimg_output)', __FILE__, __LINE__);
                      Severity: Major
                      Found in core/model/phpthumb/phpthumb.class.php - About 3 hrs to fix

                        Function ImageCreateFromFilename has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function ImageCreateFromFilename($filename) {
                                // try to create GD image source directly via GD, if possible,
                                // rather than buffering to memory and creating with imagecreatefromstring
                                $ImageCreateWasAttempted = false;
                                $gd_image = false;
                        Severity: Minor
                        Found in core/model/phpthumb/phpthumb.class.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

                        Method SetCacheFilename has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function SetCacheFilename() {
                                if (null !== $this->cache_filename) {
                                    $this->DebugMessage('$this->cache_filename already set, skipping SetCacheFilename()', __FILE__, __LINE__);
                                    return true;
                                }
                        Severity: Major
                        Found in core/model/phpthumb/phpthumb.class.php - About 3 hrs to fix

                          Function setCacheDirectory has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function setCacheDirectory() {
                                  // resolve cache directory to absolute pathname
                                  $this->DebugMessage('setCacheDirectory() starting with config_cache_directory = "'.$this->config_cache_directory.'"', __FILE__, __LINE__);
                                  if ($this->config_cache_directory && ($this->config_cache_directory[0] == '.')) {
                                      if (preg_match('#^(f|ht)tps?\://#i', $this->src)) {
                          Severity: Minor
                          Found in core/model/phpthumb/phpthumb.class.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 applyPathSegment has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function applyPathSegment(&$segments, $segment) {
                                  if ($segment == '.') {
                                      return; // always remove
                                  }
                                  if ($segment == '') {
                          Severity: Minor
                          Found in core/model/phpthumb/phpthumb.class.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 ImageCropAuto has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private function ImageCropAuto() {
                                  // ImageCropAuto
                                  if (!is_null($this->ica)) {
                                      $this->DebugMessage('ImageCropAuto('.$this->ica.') starting', __FILE__, __LINE__);
                                      if (function_exists('imagecropauto')) { // (PHP 5 >= 5.5.0, PHP 7)
                          Severity: Minor
                          Found in core/model/phpthumb/phpthumb.class.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

                          Method ImageCreateFromFilename has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function ImageCreateFromFilename($filename) {
                                  // try to create GD image source directly via GD, if possible,
                                  // rather than buffering to memory and creating with imagecreatefromstring
                                  $ImageCreateWasAttempted = false;
                                  $gd_image = false;
                          Severity: Major
                          Found in core/model/phpthumb/phpthumb.class.php - About 3 hrs to fix

                            Method ErrorImage has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function ErrorImage($text, $width=0, $height=0, $forcedisplay=false) {
                                    $width  = ($width  ? $width  : $this->config_error_image_width);
                                    $height = ($height ? $height : $this->config_error_image_height);
                            
                                    $text = 'phpThumb() v'.$this->phpthumb_version."\n".'http://phpthumb.sourceforge.net'."\n\n".($this->config_disable_debug ? 'Error messages disabled.'."\n\n".'edit phpThumb.config.php and (temporarily) set'."\n".'$PHPTHUMB_CONFIG[\'disable_debug\'] = false;'."\n".'to view the details of this error' : $text);
                            Severity: Major
                            Found in core/model/phpthumb/phpthumb.class.php - About 3 hrs to fix

                              Method Rotate has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function Rotate() {
                                      if ($this->ra || $this->ar) {
                                          if (!function_exists('imagerotate')) {
                                              $this->DebugMessage('!function_exists(imagerotate)', __FILE__, __LINE__);
                                              return false;
                              Severity: Major
                              Found in core/model/phpthumb/phpthumb.class.php - About 3 hrs to fix

                                Method setOutputFormat has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function setOutputFormat() {
                                        static $alreadyCalled = false;
                                        if ($this->thumbnailFormat && $alreadyCalled) {
                                            return true;
                                        }
                                Severity: Major
                                Found in core/model/phpthumb/phpthumb.class.php - About 3 hrs to fix

                                  Method AlphaChannelFlatten has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function AlphaChannelFlatten() {
                                          if (!$this->is_alpha) {
                                              // image doesn't have alpha transparency, no need to flatten
                                              $this->DebugMessage('skipping AlphaChannelFlatten() because !$this->is_alpha', __FILE__, __LINE__);
                                              return false;
                                  Severity: Major
                                  Found in core/model/phpthumb/phpthumb.class.php - About 2 hrs to fix

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

                                        public function phpThumbDebug($level='') {
                                            if ($level && ($this->phpThumbDebug !== $level)) {
                                                return true;
                                            }
                                            if ($this->config_disable_debug) {
                                    Severity: Minor
                                    Found in core/model/phpthumb/phpthumb.class.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 ResolveFilenameToAbsolute has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        public function ResolveFilenameToAbsolute($filename) {
                                            if (empty($filename)) {
                                                return false;
                                            }
                                    
                                    
                                    Severity: Major
                                    Found in core/model/phpthumb/phpthumb.class.php - About 2 hrs to fix

                                      Method AntiOffsiteLinking has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          public function AntiOffsiteLinking() {
                                              // Optional anti-offsite hijacking of the thumbnail script
                                              $allow   = true;
                                              if ($allow && $this->config_nooffsitelink_enabled && (@$_SERVER['HTTP_REFERER'] || $this->config_nooffsitelink_require_refer)) {
                                                  $this->DebugMessage('AntiOffsiteLinking() checking $_SERVER[HTTP_REFERER] "'.@$_SERVER['HTTP_REFERER'].'"', __FILE__, __LINE__);
                                      Severity: Major
                                      Found in core/model/phpthumb/phpthumb.class.php - About 2 hrs to fix

                                        Method GenerateThumbnail has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            public function GenerateThumbnail() {
                                        
                                                $this->setOutputFormat();
                                                    $this->phpThumbDebug('8a');
                                                $this->ResolveSource();
                                        Severity: Major
                                        Found in core/model/phpthumb/phpthumb.class.php - About 2 hrs to fix

                                          Method CalculateThumbnailDimensions has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                                          Open

                                              public function CalculateThumbnailDimensions() {
                                                  $this->DebugMessage('CalculateThumbnailDimensions() starting with [W,H,sx,sy,sw,sh] initially set to ['.$this->source_width.','.$this->source_height.','.$this->sx.','.$this->sy.','.$this->sw.','.$this->sh.']', __FILE__, __LINE__);
                                          //echo $this->source_width.'x'.$this->source_height.'<hr>';
                                                  $this->thumbnailCropX = ($this->sx ? (($this->sx >= 2) ? $this->sx : round($this->sx * $this->source_width))  : 0);
                                          //echo $this->thumbnailCropX.'<br>';
                                          Severity: Major
                                          Found in core/model/phpthumb/phpthumb.class.php - About 2 hrs to fix

                                            Function ResolveSource has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                public function ResolveSource() {
                                                    if (is_resource($this->gdimg_source) || (is_object($this->gdimg_source) && $this->gdimg_source instanceOf \GdImage)) {
                                                        $this->DebugMessage('ResolveSource() exiting because is_resource($this->gdimg_source)', __FILE__, __LINE__);
                                                        return true;
                                                    }
                                            Severity: Minor
                                            Found in core/model/phpthumb/phpthumb.class.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

                                            Function ImageMagickSwitchAvailable has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                public function ImageMagickSwitchAvailable($switchname) {
                                                    static $IMoptions = null;
                                                    if (null === $IMoptions) {
                                                        $IMoptions = array();
                                                        $commandline = $this->ImageMagickCommandlineBase();
                                            Severity: Minor
                                            Found in core/model/phpthumb/phpthumb.class.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

                                            Function CalculateThumbnailDimensions has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                public function CalculateThumbnailDimensions() {
                                                    $this->DebugMessage('CalculateThumbnailDimensions() starting with [W,H,sx,sy,sw,sh] initially set to ['.$this->source_width.','.$this->source_height.','.$this->sx.','.$this->sy.','.$this->sw.','.$this->sh.']', __FILE__, __LINE__);
                                            //echo $this->source_width.'x'.$this->source_height.'<hr>';
                                                    $this->thumbnailCropX = ($this->sx ? (($this->sx >= 2) ? $this->sx : round($this->sx * $this->source_width))  : 0);
                                            //echo $this->thumbnailCropX.'<br>';
                                            Severity: Minor
                                            Found in core/model/phpthumb/phpthumb.class.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

                                            Function resolvePath has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                public function resolvePath($path, $allowed_dirs) {
                                                    $this->DebugMessage('resolvePath: '.$path.' (allowed_dirs: '.print_r($allowed_dirs, true).')', __FILE__, __LINE__);
                                            
                                                    // add base path to the top of the list
                                                    if (!$this->config_allow_src_above_docroot) {
                                            Severity: Minor
                                            Found in core/model/phpthumb/phpthumb.class.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

                                            Function OffsiteDomainIsAllowed has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                public function OffsiteDomainIsAllowed($hostname, $allowed_domains) {
                                                    static $domain_is_allowed = array();
                                                    $hostname = strtolower($hostname);
                                                    if (!isset($domain_is_allowed[$hostname])) {
                                                        $domain_is_allowed[$hostname] = false;
                                            Severity: Minor
                                            Found in core/model/phpthumb/phpthumb.class.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 MaxFileSize has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                                public function MaxFileSize() {
                                                    if (phpthumb_functions::gd_version() < 2) {
                                                        $this->DebugMessage('Skipping MaxFileSize() because gd_version is "'.phpthumb_functions::gd_version().'"', __FILE__, __LINE__);
                                                        return false;
                                                    }
                                            Severity: Major
                                            Found in core/model/phpthumb/phpthumb.class.php - About 2 hrs to fix

                                              Method ImageMagickCommandlineBase has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                                              Open

                                                  public function ImageMagickCommandlineBase() {
                                                      static $commandline = null;
                                                      if (null === $commandline) {
                                                          if ($this->issafemode) {
                                                              $commandline = '';
                                              Severity: Major
                                              Found in core/model/phpthumb/phpthumb.class.php - About 2 hrs to fix

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

                                                    public function resolvePath($path, $allowed_dirs) {
                                                        $this->DebugMessage('resolvePath: '.$path.' (allowed_dirs: '.print_r($allowed_dirs, true).')', __FILE__, __LINE__);
                                                
                                                        // add base path to the top of the list
                                                        if (!$this->config_allow_src_above_docroot) {
                                                Severity: Minor
                                                Found in core/model/phpthumb/phpthumb.class.php - About 1 hr to fix

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

                                                      public function setCacheDirectory() {
                                                          // resolve cache directory to absolute pathname
                                                          $this->DebugMessage('setCacheDirectory() starting with config_cache_directory = "'.$this->config_cache_directory.'"', __FILE__, __LINE__);
                                                          if ($this->config_cache_directory && ($this->config_cache_directory[0] == '.')) {
                                                              if (preg_match('#^(f|ht)tps?\://#i', $this->src)) {
                                                  Severity: Minor
                                                  Found in core/model/phpthumb/phpthumb.class.php - About 1 hr to fix

                                                    Method applyPathSegment has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                                    Open

                                                        public function applyPathSegment(&$segments, $segment) {
                                                            if ($segment == '.') {
                                                                return; // always remove
                                                            }
                                                            if ($segment == '') {
                                                    Severity: Minor
                                                    Found in core/model/phpthumb/phpthumb.class.php - About 1 hr to fix

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

                                                          public function ImageMagickVersion($returnRAW=false) {
                                                              static $versionstring = null;
                                                              if (null === $versionstring) {
                                                                  $versionstring = array(0=>false, 1=>false);
                                                      
                                                      
                                                      Severity: Minor
                                                      Found in core/model/phpthumb/phpthumb.class.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 ResolveSource has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                                      Open

                                                          public function ResolveSource() {
                                                              if (is_resource($this->gdimg_source) || (is_object($this->gdimg_source) && $this->gdimg_source instanceOf \GdImage)) {
                                                                  $this->DebugMessage('ResolveSource() exiting because is_resource($this->gdimg_source)', __FILE__, __LINE__);
                                                                  return true;
                                                              }
                                                      Severity: Minor
                                                      Found in core/model/phpthumb/phpthumb.class.php - About 1 hr to fix

                                                        Function RenderToFile has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                                        Open

                                                            public function RenderToFile($filename) {
                                                                if (preg_match('#^[a-z0-9]+://#i', $filename)) {
                                                                    $this->DebugMessage('RenderToFile() failed because $filename ('.$filename.') is a URL', __FILE__, __LINE__);
                                                                    return false;
                                                                }
                                                        Severity: Minor
                                                        Found in core/model/phpthumb/phpthumb.class.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 FixedAspectRatio has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                                        Open

                                                            public function FixedAspectRatio() {
                                                                // optional fixed-dimension images (regardless of aspect ratio)
                                                        
                                                                if (!$this->far) {
                                                                    // do nothing
                                                        Severity: Minor
                                                        Found in core/model/phpthumb/phpthumb.class.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 ImageResizeFunction has 10 arguments (exceeds 4 allowed). Consider refactoring.
                                                        Open

                                                            public function ImageResizeFunction(&$dst_im, &$src_im, $dstX, $dstY, $srcX, $srcY, $dstW, $dstH, $srcW, $srcH) {
                                                        Severity: Major
                                                        Found in core/model/phpthumb/phpthumb.class.php - About 1 hr to fix

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

                                                              private function ImageCropAuto() {
                                                                  // ImageCropAuto
                                                                  if (!is_null($this->ica)) {
                                                                      $this->DebugMessage('ImageCropAuto('.$this->ica.') starting', __FILE__, __LINE__);
                                                                      if (function_exists('imagecropauto')) { // (PHP 5 >= 5.5.0, PHP 7)
                                                          Severity: Minor
                                                          Found in core/model/phpthumb/phpthumb.class.php - About 1 hr to fix

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

                                                                public function RenderToFile($filename) {
                                                                    if (preg_match('#^[a-z0-9]+://#i', $filename)) {
                                                                        $this->DebugMessage('RenderToFile() failed because $filename ('.$filename.') is a URL', __FILE__, __LINE__);
                                                                        return false;
                                                                    }
                                                            Severity: Minor
                                                            Found in core/model/phpthumb/phpthumb.class.php - About 1 hr to fix

                                                              Method ImageMagickVersion has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                                              Open

                                                                  public function ImageMagickVersion($returnRAW=false) {
                                                                      static $versionstring = null;
                                                                      if (null === $versionstring) {
                                                                          $versionstring = array(0=>false, 1=>false);
                                                              
                                                              
                                                              Severity: Minor
                                                              Found in core/model/phpthumb/phpthumb.class.php - About 1 hr to fix

                                                                Method FixedAspectRatio has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                Open

                                                                    public function FixedAspectRatio() {
                                                                        // optional fixed-dimension images (regardless of aspect ratio)
                                                                
                                                                        if (!$this->far) {
                                                                            // do nothing
                                                                Severity: Minor
                                                                Found in core/model/phpthumb/phpthumb.class.php - About 1 hr to fix

                                                                  Method ImageMagickSwitchAvailable has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                  Open

                                                                      public function ImageMagickSwitchAvailable($switchname) {
                                                                          static $IMoptions = null;
                                                                          if (null === $IMoptions) {
                                                                              $IMoptions = array();
                                                                              $commandline = $this->ImageMagickCommandlineBase();
                                                                  Severity: Minor
                                                                  Found in core/model/phpthumb/phpthumb.class.php - About 1 hr to fix

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

                                                                        public function phpThumb() {
                                                                            $this->DebugTimingMessage('phpThumb() constructor', __FILE__, __LINE__);
                                                                            $this->DebugMessage('phpThumb() v'.$this->phpthumb_version, __FILE__, __LINE__);
                                                                    
                                                                            foreach (array(ini_get('memory_limit'), get_cfg_var('memory_limit')) as $php_config_memory_limit) {
                                                                    Severity: Minor
                                                                    Found in core/model/phpthumb/phpthumb.class.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 setParameter has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                                                    Open

                                                                        public function setParameter($param, $value) {
                                                                            if ($param == 'src') {
                                                                                $this->setSourceFilename($this->ResolveFilenameToAbsolute($value));
                                                                            } elseif (isset($this->$param) && is_array($this->$param)) {
                                                                                if (is_array($value)) {
                                                                    Severity: Minor
                                                                    Found in core/model/phpthumb/phpthumb.class.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 phpThumb has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                    Open

                                                                        public function phpThumb() {
                                                                            $this->DebugTimingMessage('phpThumb() constructor', __FILE__, __LINE__);
                                                                            $this->DebugMessage('phpThumb() v'.$this->phpthumb_version, __FILE__, __LINE__);
                                                                    
                                                                            foreach (array(ini_get('memory_limit'), get_cfg_var('memory_limit')) as $php_config_memory_limit) {
                                                                    Severity: Minor
                                                                    Found in core/model/phpthumb/phpthumb.class.php - About 1 hr to fix

                                                                      Consider simplifying this complex logical expression.
                                                                      Open

                                                                                                  if ($this->iar && ((int) $this->w > 0) && ((int) $this->h > 0)) {
                                                                      
                                                                                                      list($nw, $nh) = phpthumb_functions::TranslateWHbyAngle($this->w, $this->h, $this->ra);
                                                                                                      $nw = ((round($nw) != 0) ? round($nw) : '');
                                                                                                      $nh = ((round($nh) != 0) ? round($nh) : '');
                                                                      Severity: Major
                                                                      Found in core/model/phpthumb/phpthumb.class.php - About 1 hr to fix

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

                                                                            public function CreateGDoutput() {
                                                                                $this->CalculateThumbnailDimensions();
                                                                        
                                                                                // create the GD image (either true-color or 256-color, depending on GD version)
                                                                                $this->gdimg_output = phpthumb_functions::ImageCreateFunction($this->thumbnail_width, $this->thumbnail_height);
                                                                        Severity: Minor
                                                                        Found in core/model/phpthumb/phpthumb.class.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 file_exists_ignoreopenbasedir has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                                        Open

                                                                            public function file_exists_ignoreopenbasedir($filename, $cached=true) {
                                                                                static $open_basedirs = null;
                                                                                static $file_exists_cache = array();
                                                                                if (!$cached || !isset($file_exists_cache[$filename])) {
                                                                                    if (is_null($open_basedirs)) {
                                                                        Severity: Minor
                                                                        Found in core/model/phpthumb/phpthumb.class.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

                                                                        Avoid deeply nested control flow statements.
                                                                        Open

                                                                                                                if (preg_match('# \\-crop "([\d]+)x([\d]+)\\+0\\+0" #', $commandline, $matches)) {
                                                                                                                    $commandline = str_replace(' -crop "'.$matches[1].'x'.$matches[2].'+0+0" ', ' -crop '.phpthumb_functions::escapeshellarg_replacement(($matches[1] - (2 * $width)).'x'.($matches[2] - (2 * $width)).'+0+0').' ', $commandline);
                                                                                                                } elseif (preg_match('# \\-'.$IMresizeParameter.' "([0-9]+)x([0-9]+)" #', $commandline, $matches)) {
                                                                                                                    $commandline = str_replace(' -'.$IMresizeParameter.' "'.$matches[1].'x'.$matches[2].'" ', ' -'.$IMresizeParameter.' '.phpthumb_functions::escapeshellarg_replacement(($matches[1] - (2 * $width)).'x'.($matches[2] - (2 * $width))).' ', $commandline);
                                                                                                                }
                                                                        Severity: Major
                                                                        Found in core/model/phpthumb/phpthumb.class.php - About 45 mins to fix

                                                                          Function ImageMagickWhichConvert has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                                          Open

                                                                              public function ImageMagickWhichConvert() {
                                                                                  static $WhichConvert = null;
                                                                                  if (null === $WhichConvert) {
                                                                                      if ($this->iswindows) {
                                                                                          $WhichConvert = false;
                                                                          Severity: Minor
                                                                          Found in core/model/phpthumb/phpthumb.class.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 deeply nested control flow statements.
                                                                          Open

                                                                                                      if (strlen($imgdata) <= $this->maxb) {
                                                                                                          break;
                                                                                                      }
                                                                          Severity: Major
                                                                          Found in core/model/phpthumb/phpthumb.class.php - About 45 mins to fix

                                                                            Avoid deeply nested control flow statements.
                                                                            Open

                                                                                                                    if (!phpthumb_functions::IsHexColor($color)) {
                                                                                                                        $color = ((!empty($this->bc) && phpthumb_functions::IsHexColor($this->bc)) ? $this->bc : '000000');
                                                                                                                    }
                                                                            Severity: Major
                                                                            Found in core/model/phpthumb/phpthumb.class.php - About 45 mins to fix

                                                                              Avoid deeply nested control flow statements.
                                                                              Open

                                                                                                          if (strlen($imgdata) <= $this->maxb) {
                                                                                                              imagetruecolortopalette($this->gdimg_output, true, pow(2, $i));
                                                                                                              break;
                                                                                                          }
                                                                              Severity: Major
                                                                              Found in core/model/phpthumb/phpthumb.class.php - About 45 mins to fix

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

                                                                                    public function setSourceData($rawImageData, $sourceFilename='') {
                                                                                        //$this->resetObject();
                                                                                        //$this->sourceFilename = null;
                                                                                        $this->rawImageData   = $rawImageData;
                                                                                        $this->DebugMessage('setSourceData() setting $this->rawImageData ('.strlen($this->rawImageData).' bytes; magic="'.substr($this->rawImageData, 0, 4).'" ('.phpthumb_functions::HexCharDisplay(substr($this->rawImageData, 0, 4)).'))', __FILE__, __LINE__);
                                                                                Severity: Minor
                                                                                Found in core/model/phpthumb/phpthumb.class.php - About 35 mins to fix

                                                                                Cognitive Complexity

                                                                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                A method's cognitive complexity is based on a few simple rules:

                                                                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                • Code is considered more complex for each "break in the linear flow of the code"
                                                                                • Code is considered more complex when "flow breaking structures are nested"

                                                                                Further reading

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

                                                                                    public function isInOpenBasedir($path) {
                                                                                        static $open_basedirs = null;
                                                                                        if (null === $open_basedirs) {
                                                                                            $ini_text = ini_get('open_basedir');
                                                                                            $this->DebugMessage('open_basedir: "'.$ini_text.'"', __FILE__, __LINE__);
                                                                                Severity: Minor
                                                                                Found in core/model/phpthumb/phpthumb.class.php - About 35 mins to fix

                                                                                Cognitive Complexity

                                                                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                A method's cognitive complexity is based on a few simple rules:

                                                                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                • Code is considered more complex for each "break in the linear flow of the code"
                                                                                • Code is considered more complex when "flow breaking structures are nested"

                                                                                Further reading

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

                                                                                    public function GenerateThumbnail() {
                                                                                
                                                                                        $this->setOutputFormat();
                                                                                            $this->phpThumbDebug('8a');
                                                                                        $this->ResolveSource();
                                                                                Severity: Minor
                                                                                Found in core/model/phpthumb/phpthumb.class.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 true;
                                                                                Severity: Major
                                                                                Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                  Avoid too many return statements within this method.
                                                                                  Open

                                                                                                          return false;
                                                                                  Severity: Major
                                                                                  Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                    Avoid too many return statements within this method.
                                                                                    Open

                                                                                                        return false;
                                                                                    Severity: Major
                                                                                    Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                      Avoid too many return statements within this method.
                                                                                      Open

                                                                                                          return false;
                                                                                      Severity: Major
                                                                                      Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                        Avoid too many return statements within this method.
                                                                                        Open

                                                                                                    return false;
                                                                                        Severity: Major
                                                                                        Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                          Avoid too many return statements within this method.
                                                                                          Open

                                                                                                  return true;
                                                                                          Severity: Major
                                                                                          Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                            Avoid too many return statements within this method.
                                                                                            Open

                                                                                                                return false;
                                                                                            Severity: Major
                                                                                            Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                              Avoid too many return statements within this method.
                                                                                              Open

                                                                                                                  return false;
                                                                                              Severity: Major
                                                                                              Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                Avoid too many return statements within this method.
                                                                                                Open

                                                                                                                        return false;
                                                                                                Severity: Major
                                                                                                Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                  Avoid too many return statements within this method.
                                                                                                  Open

                                                                                                              return true;
                                                                                                  Severity: Major
                                                                                                  Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                    Avoid too many return statements within this method.
                                                                                                    Open

                                                                                                                        return false;
                                                                                                    Severity: Major
                                                                                                    Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                      Avoid too many return statements within this method.
                                                                                                      Open

                                                                                                              return true;
                                                                                                      Severity: Major
                                                                                                      Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                        Avoid too many return statements within this method.
                                                                                                        Open

                                                                                                                return true;
                                                                                                        Severity: Major
                                                                                                        Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                          Avoid too many return statements within this method.
                                                                                                          Open

                                                                                                                  return true;
                                                                                                          Severity: Major
                                                                                                          Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                            Avoid too many return statements within this method.
                                                                                                            Open

                                                                                                                    return $resolvedAbsoluteFilename;
                                                                                                            Severity: Major
                                                                                                            Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                              Avoid too many return statements within this method.
                                                                                                              Open

                                                                                                                                  return true;
                                                                                                              Severity: Major
                                                                                                              Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                Avoid too many return statements within this method.
                                                                                                                Open

                                                                                                                                            return false;
                                                                                                                Severity: Major
                                                                                                                Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                  Avoid too many return statements within this method.
                                                                                                                  Open

                                                                                                                              return $this->ErrorImage('"'.$this->sourceFilename.'" does not exist');
                                                                                                                  Severity: Major
                                                                                                                  Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                    Avoid too many return statements within this method.
                                                                                                                    Open

                                                                                                                                    return false;
                                                                                                                    Severity: Major
                                                                                                                    Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                      Avoid too many return statements within this method.
                                                                                                                      Open

                                                                                                                                              return false;
                                                                                                                      Severity: Major
                                                                                                                      Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                        Avoid too many return statements within this method.
                                                                                                                        Open

                                                                                                                                                            return false;
                                                                                                                        Severity: Major
                                                                                                                        Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                          Avoid too many return statements within this method.
                                                                                                                          Open

                                                                                                                                                  return false;
                                                                                                                          Severity: Major
                                                                                                                          Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                            Avoid too many return statements within this method.
                                                                                                                            Open

                                                                                                                                                    return false;
                                                                                                                            Severity: Major
                                                                                                                            Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                              Avoid too many return statements within this method.
                                                                                                                              Open

                                                                                                                                                          return false;
                                                                                                                              Severity: Major
                                                                                                                              Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                Open

                                                                                                                                                                return false;
                                                                                                                                Severity: Major
                                                                                                                                Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                  Open

                                                                                                                                                      return false;
                                                                                                                                  Severity: Major
                                                                                                                                  Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                    Avoid too many return statements within this method.
                                                                                                                                    Open

                                                                                                                                                        return false;
                                                                                                                                    Severity: Major
                                                                                                                                    Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                      Avoid too many return statements within this method.
                                                                                                                                      Open

                                                                                                                                                          return false;
                                                                                                                                      Severity: Major
                                                                                                                                      Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                        Avoid too many return statements within this method.
                                                                                                                                        Open

                                                                                                                                                    return false;
                                                                                                                                        Severity: Major
                                                                                                                                        Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                          Avoid too many return statements within this method.
                                                                                                                                          Open

                                                                                                                                                              return false;
                                                                                                                                          Severity: Major
                                                                                                                                          Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                            Avoid too many return statements within this method.
                                                                                                                                            Open

                                                                                                                                                    return false;
                                                                                                                                            Severity: Major
                                                                                                                                            Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                              Avoid too many return statements within this method.
                                                                                                                                              Open

                                                                                                                                                              return $this->ErrorImage('Invalid hex color string "'.$this->config_background_hexcolor.'" for parameter "bg"');
                                                                                                                                              Severity: Major
                                                                                                                                              Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                                Open

                                                                                                                                                            return false;
                                                                                                                                                Severity: Major
                                                                                                                                                Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                                  Open

                                                                                                                                                          return false;
                                                                                                                                                  Severity: Major
                                                                                                                                                  Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                    Avoid too many return statements within this method.
                                                                                                                                                    Open

                                                                                                                                                                return $this->ErrorImage('"'.$this->sourceFilename.'" is not a file');
                                                                                                                                                    Severity: Major
                                                                                                                                                    Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                      Avoid too many return statements within this method.
                                                                                                                                                      Open

                                                                                                                                                                                  return false;
                                                                                                                                                      Severity: Major
                                                                                                                                                      Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                        Avoid too many return statements within this method.
                                                                                                                                                        Open

                                                                                                                                                                        return true;
                                                                                                                                                        Severity: Major
                                                                                                                                                        Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                          Avoid too many return statements within this method.
                                                                                                                                                          Open

                                                                                                                                                                              return $this->ErrorImage('Image (JPEG) is too large for PHP-GD memory_limit, please install ImageMagick or increase php.ini memory_limit setting');
                                                                                                                                                          Severity: Major
                                                                                                                                                          Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                            Avoid too many return statements within this method.
                                                                                                                                                            Open

                                                                                                                                                                            return true;
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                              Avoid too many return statements within this method.
                                                                                                                                                              Open

                                                                                                                                                                                              return false;
                                                                                                                                                              Severity: Major
                                                                                                                                                              Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                                                Open

                                                                                                                                                                                            return $gdimg_source;
                                                                                                                                                                Severity: Major
                                                                                                                                                                Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                                                  Open

                                                                                                                                                                          return false;
                                                                                                                                                                  Severity: Major
                                                                                                                                                                  Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                                    Avoid too many return statements within this method.
                                                                                                                                                                    Open

                                                                                                                                                                                        return $this->ErrorImage($this->ImageMagickVersion() ? 'ImageMagick failed on TIFF source conversion' : 'ImageMagick is unavailable and phpThumb() does not support TIFF source images without it');
                                                                                                                                                                    Severity: Major
                                                                                                                                                                    Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                                      Avoid too many return statements within this method.
                                                                                                                                                                      Open

                                                                                                                                                                              return true;
                                                                                                                                                                      Severity: Major
                                                                                                                                                                      Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                                        Avoid too many return statements within this method.
                                                                                                                                                                        Open

                                                                                                                                                                                return true;
                                                                                                                                                                        Severity: Major
                                                                                                                                                                        Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                                          Avoid too many return statements within this method.
                                                                                                                                                                          Open

                                                                                                                                                                                      return false;
                                                                                                                                                                          Severity: Major
                                                                                                                                                                          Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                                            Avoid too many return statements within this method.
                                                                                                                                                                            Open

                                                                                                                                                                                                        return false;
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                                              Avoid too many return statements within this method.
                                                                                                                                                                              Open

                                                                                                                                                                                                      return $this->ErrorImage($this->ImageMagickVersion() ? 'ImageMagick failed on BMP source conversion' : 'phpthumb_bmp2gd() failed');
                                                                                                                                                                              Severity: Major
                                                                                                                                                                              Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                                                                Open

                                                                                                                                                                                            return strtr($vardumpoutput, "\n\r\t", '   ');
                                                                                                                                                                                Severity: Major
                                                                                                                                                                                Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                                                                  Open

                                                                                                                                                                                                          return $this->ErrorImage('failed to open "'.$this->sourceFilename.'" SourceImageToGD() ['.__LINE__.']');
                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                  Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                                                    Avoid too many return statements within this method.
                                                                                                                                                                                    Open

                                                                                                                                                                                                        return false;
                                                                                                                                                                                    Severity: Major
                                                                                                                                                                                    Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                                                      Avoid too many return statements within this method.
                                                                                                                                                                                      Open

                                                                                                                                                                                                                  return false;
                                                                                                                                                                                      Severity: Major
                                                                                                                                                                                      Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                                                        Avoid too many return statements within this method.
                                                                                                                                                                                        Open

                                                                                                                                                                                                            return $this->ErrorImage('Neither GD nor ImageMagick seem to be installed on this server. At least one (preferably GD), or better both, MUST be installed for phpThumb to work.');
                                                                                                                                                                                        Severity: Major
                                                                                                                                                                                        Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                                                          Avoid too many return statements within this method.
                                                                                                                                                                                          Open

                                                                                                                                                                                                  return true;
                                                                                                                                                                                          Severity: Major
                                                                                                                                                                                          Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                                                            Avoid too many return statements within this method.
                                                                                                                                                                                            Open

                                                                                                                                                                                                                return $this->ErrorImage('Image (GIF) is too large for PHP-GD memory_limit, please install ImageMagick or increase php.ini memory_limit setting');
                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                            Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                                                              Avoid too many return statements within this method.
                                                                                                                                                                                              Open

                                                                                                                                                                                                      return gettype($var);
                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                              Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                                                                                Open

                                                                                                                                                                                                                            return false;
                                                                                                                                                                                                Severity: Major
                                                                                                                                                                                                Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                                                                                  Open

                                                                                                                                                                                                                      return $gdimg_source;
                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                  Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                                                                    Avoid too many return statements within this method.
                                                                                                                                                                                                    Open

                                                                                                                                                                                                                            return $this->ErrorImage('include_once('. __DIR__ .'/phpthumb.bmp.php) failed');
                                                                                                                                                                                                    Severity: Major
                                                                                                                                                                                                    Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                                                                      Avoid too many return statements within this method.
                                                                                                                                                                                                      Open

                                                                                                                                                                                                                          return $this->ErrorImage('Unable to create image, neither filename nor image data suppplied in SourceImageToGD() ['.__LINE__.']');
                                                                                                                                                                                                      Severity: Major
                                                                                                                                                                                                      Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                                                                        Avoid too many return statements within this method.
                                                                                                                                                                                                        Open

                                                                                                                                                                                                                            return $this->ErrorImage($this->ImageMagickVersion() ? 'ImageMagick and GhostScript are both required for PDF source images; GhostScript may not be properly configured' : 'ImageMagick and/or GhostScript are unavailable and phpThumb() does not support PDF source images without them');
                                                                                                                                                                                                        Severity: Major
                                                                                                                                                                                                        Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                                                                          Avoid too many return statements within this method.
                                                                                                                                                                                                          Open

                                                                                                                                                                                                                      return 'float       '.$var;
                                                                                                                                                                                                          Severity: Major
                                                                                                                                                                                                          Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                                                                            Avoid too many return statements within this method.
                                                                                                                                                                                                            Open

                                                                                                                                                                                                                        return $this->ErrorImage($ErrorMessage);
                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                            Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                                                                              Avoid too many return statements within this method.
                                                                                                                                                                                                              Open

                                                                                                                                                                                                                                  return $this->ErrorImage($this->ImageMagickVersion() ? 'ImageMagick failed on WMF source conversion' : 'ImageMagick is unavailable and phpThumb() does not support WMF source images without it');
                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                              Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                return $this->ErrorImage('Unknown image type identified by "'.$HeaderFourBytes.'" ('.phpthumb_functions::HexCharDisplay($HeaderFourBytes).') in SourceImageToGD() ['.__LINE__.']');
                                                                                                                                                                                                                Severity: Major
                                                                                                                                                                                                                Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                                                                                                  Open

                                                                                                                                                                                                                                      return $this->ErrorImage('Image (PNG) is too large for PHP-GD memory_limit, please install ImageMagick or increase php.ini memory_limit setting');
                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                  Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                                                                                    Avoid too many return statements within this method.
                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                            return false;
                                                                                                                                                                                                                    Severity: Major
                                                                                                                                                                                                                    Found in core/model/phpthumb/phpthumb.class.php - About 30 mins to fix

                                                                                                                                                                                                                      Function phpThumbDebugVarDump has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                                                                                                      Open

                                                                                                                                                                                                                          public function phpThumbDebugVarDump($var) {
                                                                                                                                                                                                                              if (null === $var) {
                                                                                                                                                                                                                                  return 'NULL';
                                                                                                                                                                                                                              } elseif (is_bool($var)) {
                                                                                                                                                                                                                                  return ($var ? 'TRUE' : 'FALSE');
                                                                                                                                                                                                                      Severity: Minor
                                                                                                                                                                                                                      Found in core/model/phpthumb/phpthumb.class.php - About 25 mins to fix

                                                                                                                                                                                                                      Cognitive Complexity

                                                                                                                                                                                                                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                                                                                                                      A method's cognitive complexity is based on a few simple rules:

                                                                                                                                                                                                                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                                                                                                                      • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                                                                                                                      • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                                                                                                                      Further reading

                                                                                                                                                                                                                      Function matchPath has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                                                                                                      Open

                                                                                                                                                                                                                          public function matchPath($path, $allowed_dirs) {
                                                                                                                                                                                                                              if (!empty($allowed_dirs)) {
                                                                                                                                                                                                                                  foreach ($allowed_dirs as $one_dir) {
                                                                                                                                                                                                                                      if (preg_match('#^'.preg_quote(str_replace(DIRECTORY_SEPARATOR, '/', $this->realPathSafe($one_dir))).'#', $path)) {
                                                                                                                                                                                                                                          return true;
                                                                                                                                                                                                                      Severity: Minor
                                                                                                                                                                                                                      Found in core/model/phpthumb/phpthumb.class.php - About 25 mins to fix

                                                                                                                                                                                                                      Cognitive Complexity

                                                                                                                                                                                                                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                                                                                                                      A method's cognitive complexity is based on a few simple rules:

                                                                                                                                                                                                                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                                                                                                                      • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                                                                                                                      • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                                                                                                                      Further reading

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

                                                                                                                                                                                                                                  if (@is_readable($filename) && !@is_readable($this->config_document_root.$filename)) {
                                                                                                                                                                                                                      
                                                                                                                                                                                                                                      // absolute filename (*nix)
                                                                                                                                                                                                                                      $AbsoluteFilename = $filename;
                                                                                                                                                                                                                      
                                                                                                                                                                                                                      
                                                                                                                                                                                                                      Severity: Major
                                                                                                                                                                                                                      Found in core/model/phpthumb/phpthumb.class.php and 1 other location - About 2 hrs to fix
                                                                                                                                                                                                                      core/model/phpthumb/modphpthumb.class.php on lines 298..330

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

                                                                                                                                                                                                                      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

                                                                                                                                                                                                                              $ConfigVariableNames = array('document_root', 'temp_directory', 'output_format', 'output_maxwidth', 'output_maxheight', 'error_message_image_default', 'error_bgcolor', 'error_textcolor', 'error_fontsize', 'error_die_on_error', 'error_silent_die_on_error', 'error_die_on_source_failure', 'nohotlink_enabled', 'nohotlink_valid_domains', 'nohotlink_erase_image', 'nohotlink_text_message', 'nooffsitelink_enabled', 'nooffsitelink_valid_domains', 'nooffsitelink_require_refer', 'nooffsitelink_erase_image', 'nooffsitelink_text_message', 'high_security_enabled', 'allow_src_above_docroot', 'allow_src_above_phpthumb', 'max_source_pixels', 'use_exif_thumbnail_for_speed', 'border_hexcolor', 'background_hexcolor', 'ttf_directory', 'disable_pathinfo_parsing', 'disable_imagecopyresampled');
                                                                                                                                                                                                                      Severity: Minor
                                                                                                                                                                                                                      Found in core/model/phpthumb/phpthumb.class.php and 1 other location - About 45 mins to fix
                                                                                                                                                                                                                      manager/min/lib/JSMinPlus.php on lines 1722..1735

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

                                                                                                                                                                                                                      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 ($IMuseExplicitImageOutputDimensions) {
                                                                                                                                                                                                                                                          if ($this->w && !$this->h) {
                                                                                                                                                                                                                                                              $this->h = ceil($this->w / ($this->source_width / $this->source_height));
                                                                                                                                                                                                                                                          } elseif ($this->h && !$this->w) {
                                                                                                                                                                                                                                                              $this->w = ceil($this->h * ($this->source_width / $this->source_height));
                                                                                                                                                                                                                      Severity: Minor
                                                                                                                                                                                                                      Found in core/model/phpthumb/phpthumb.class.php and 1 other location - About 40 mins to fix
                                                                                                                                                                                                                      core/model/phpthumb/phpthumb.class.php on lines 1985..1991

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

                                                                                                                                                                                                                      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 ($IMuseExplicitImageOutputDimensions) {
                                                                                                                                                                                                                                                              if ($this->w && !$this->h) {
                                                                                                                                                                                                                                                                  $this->h = ceil($this->w / ($this->source_width / $this->source_height));
                                                                                                                                                                                                                                                              } elseif ($this->h && !$this->w) {
                                                                                                                                                                                                                                                                  $this->w = ceil($this->h * ($this->source_width / $this->source_height));
                                                                                                                                                                                                                      Severity: Minor
                                                                                                                                                                                                                      Found in core/model/phpthumb/phpthumb.class.php and 1 other location - About 40 mins to fix
                                                                                                                                                                                                                      core/model/phpthumb/phpthumb.class.php on lines 1950..1956

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

                                                                                                                                                                                                                      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

                                                                                                                                                                                                                                          case 'sep': // Sepia
                                                                                                                                                                                                                                              if (phpthumb_functions::gd_version() < 2) {
                                                                                                                                                                                                                                                  $this->DebugMessage('Skipping Sepia() because gd_version is "'.phpthumb_functions::gd_version().'"', __FILE__, __LINE__);
                                                                                                                                                                                                                                                  break;
                                                                                                                                                                                                                                              }
                                                                                                                                                                                                                      Severity: Minor
                                                                                                                                                                                                                      Found in core/model/phpthumb/phpthumb.class.php and 1 other location - About 35 mins to fix
                                                                                                                                                                                                                      core/model/phpthumb/phpthumb.class.php on lines 2844..2851

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

                                                                                                                                                                                                                      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

                                                                                                                                                                                                                                          case 'clr': // Colorize
                                                                                                                                                                                                                                              if (phpthumb_functions::gd_version() < 2) {
                                                                                                                                                                                                                                                  $this->DebugMessage('Skipping Colorize() because gd_version is "'.phpthumb_functions::gd_version().'"', __FILE__, __LINE__);
                                                                                                                                                                                                                                                  break;
                                                                                                                                                                                                                                              }
                                                                                                                                                                                                                      Severity: Minor
                                                                                                                                                                                                                      Found in core/model/phpthumb/phpthumb.class.php and 1 other location - About 35 mins to fix
                                                                                                                                                                                                                      core/model/phpthumb/phpthumb.class.php on lines 2853..2860

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

                                                                                                                                                                                                                      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