mambax7/pedigree

View on GitHub
phpthumb/phpthumb.functions.php

Summary

Maintainability
F
1 wk
Test Coverage

File phpthumb.functions.php has 962 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 phpthumb/phpthumb.functions.php - About 2 days to fix

    Function gd_info has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
    Open

        function gd_info()
        {
            static $gd_info = [];
            if (empty($gd_info)) {
                // based on code by johnschaefer at gmx dot de
    Severity: Minor
    Found in phpthumb/phpthumb.functions.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

    phpthumb_functions has 46 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class phpthumb_functions
    {
        public static function is_windows()
        {
            return (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN');
    Severity: Minor
    Found in phpthumb/phpthumb.functions.php - About 6 hrs to fix

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

          public static function SafeURLread($url, &$error, $timeout = 10, $followredirects = true)
          {
              $error   = '';
              $errstr  = '';
              $rawData = '';
      Severity: Minor
      Found in phpthumb/phpthumb.functions.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 URLreadFsock has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function URLreadFsock($host, $file, &$errstr, $successonly = true, $port = -1, $timeout = 10)
          {
              if (!function_exists('fsockopen') || self::FunctionIsDisabled('fsockopen')) {
                  $errstr = 'URLreadFsock says: function fsockopen() unavailable';
                  return false;
      Severity: Minor
      Found in phpthumb/phpthumb.functions.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 SafeURLread has 76 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function SafeURLread($url, &$error, $timeout = 10, $followredirects = true)
          {
              $error   = '';
              $errstr  = '';
              $rawData = '';
      Severity: Major
      Found in phpthumb/phpthumb.functions.php - About 3 hrs to fix

        Function EnsureDirectoryExists has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function EnsureDirectoryExists($dirname, $mask = 0755)
            {
                // https://www.php.net/manual/en/ini.core.php#ini.open-basedir says:
                // "Under Windows, separate the directories with a semicolon. On all other systems, separate the directories with a colon."
                $config_open_basedir = ini_get('open_basedir');
        Severity: Minor
        Found in phpthumb/phpthumb.functions.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 gd_info has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function gd_info()
            {
                static $gd_info = [];
                if (empty($gd_info)) {
                    // based on code by johnschaefer at gmx dot de
        Severity: Major
        Found in phpthumb/phpthumb.functions.php - About 2 hrs to fix

          Method version_compare_replacement_sub has 49 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function version_compare_replacement_sub($version1, $version2, $operator = '')
              {
                  // If you specify the third optional operator argument, you can test for a particular relationship.
                  // The possible operators are: <, lt, <=, le, >, gt, >=, ge, ==, =, eq, !=, <>, ne respectively.
                  // Using this argument, the function will return 1 if the relationship is the one specified by the operator, 0 otherwise.
          Severity: Minor
          Found in phpthumb/phpthumb.functions.php - About 1 hr to fix

            Function GetAllFilesInSubfolders has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function GetAllFilesInSubfolders($dirname)
                {
                    $AllFiles = [];
                    $dirname  = rtrim(realpath($dirname), '/\\');
                    if ($dirhandle = @opendir($dirname)) {
            Severity: Minor
            Found in phpthumb/phpthumb.functions.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 URLreadFsock has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function URLreadFsock($host, $file, &$errstr, $successonly = true, $port = -1, $timeout = 10)
                {
                    if (!function_exists('fsockopen') || self::FunctionIsDisabled('fsockopen')) {
                        $errstr = 'URLreadFsock says: function fsockopen() unavailable';
                        return false;
            Severity: Minor
            Found in phpthumb/phpthumb.functions.php - About 1 hr to fix

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

                  public static function EnsureDirectoryExists($dirname, $mask = 0755)
                  {
                      // https://www.php.net/manual/en/ini.core.php#ini.open-basedir says:
                      // "Under Windows, separate the directories with a semicolon. On all other systems, separate the directories with a colon."
                      $config_open_basedir = ini_get('open_basedir');
              Severity: Minor
              Found in phpthumb/phpthumb.functions.php - About 1 hr to fix

                Method SafeExec has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function SafeExec($command)
                    {
                        static $AllowedExecFunctions = [];
                        if (empty($AllowedExecFunctions)) {
                            $AllowedExecFunctions = ['shell_exec' => true, 'passthru' => true, 'system' => true, 'exec' => true];
                Severity: Minor
                Found in phpthumb/phpthumb.functions.php - About 1 hr to fix

                  Method ImageCopyResampleBicubic has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function ImageCopyResampleBicubic($dst_img, $src_img, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h)
                      {
                          // ron at korving dot demon dot nl
                          // http://www.php.net/imagecopyresampled
                  
                  
                  Severity: Minor
                  Found in phpthumb/phpthumb.functions.php - About 1 hr to fix

                    Method CleanUpURLencoding has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function CleanUpURLencoding($url, $queryseperator = '&')
                        {
                            if (!0 === stripos($url, "http")) {
                                return $url;
                            }
                    Severity: Minor
                    Found in phpthumb/phpthumb.functions.php - About 1 hr to fix

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

                          public static function SafeExec($command)
                          {
                              static $AllowedExecFunctions = [];
                              if (empty($AllowedExecFunctions)) {
                                  $AllowedExecFunctions = ['shell_exec' => true, 'passthru' => true, 'system' => true, 'exec' => true];
                      Severity: Minor
                      Found in phpthumb/phpthumb.functions.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 ImageCopyResampleBicubic has 10 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          public static function ImageCopyResampleBicubic($dst_img, $src_img, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h)
                      Severity: Major
                      Found in phpthumb/phpthumb.functions.php - About 1 hr to fix

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

                            public static function ImageTypeToMIMEtype($imagetype)
                            {
                                if (function_exists('image_type_to_mime_type') && ($imagetype >= 1) && ($imagetype <= 18)) {
                                    // PHP v4.3.0+
                                    return image_type_to_mime_type($imagetype);
                        Severity: Minor
                        Found in phpthumb/phpthumb.functions.php - About 1 hr to fix

                          Method ImageCopyRespectAlpha has 9 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              public static function ImageCopyRespectAlpha(&$dst_im, &$src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h, $opacity_pct = 100)
                          Severity: Major
                          Found in phpthumb/phpthumb.functions.php - About 1 hr to fix

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

                                public static function version_compare_replacement_sub($version1, $version2, $operator = '')
                                {
                                    // If you specify the third optional operator argument, you can test for a particular relationship.
                                    // The possible operators are: <, lt, <=, le, >, gt, >=, ge, ==, =, eq, !=, <>, ne respectively.
                                    // Using this argument, the function will return 1 if the relationship is the one specified by the operator, 0 otherwise.
                            Severity: Minor
                            Found in phpthumb/phpthumb.functions.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 exif_info has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public static function exif_info()
                                {
                                    static $exif_info = [];
                                    if (empty($exif_info)) {
                                        // based on code by johnschaefer at gmx dot de
                            Severity: Minor
                            Found in phpthumb/phpthumb.functions.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 CleanUpURLencoding has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public static function CleanUpURLencoding($url, $queryseperator = '&')
                                {
                                    if (!0 === stripos($url, "http")) {
                                        return $url;
                                    }
                            Severity: Minor
                            Found in phpthumb/phpthumb.functions.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 GetAllFilesInSubfolders has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public static function GetAllFilesInSubfolders($dirname)
                                {
                                    $AllFiles = [];
                                    $dirname  = rtrim(realpath($dirname), '/\\');
                                    if ($dirhandle = @opendir($dirname)) {
                            Severity: Minor
                            Found in phpthumb/phpthumb.functions.php - About 1 hr to fix

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

                                  public static function filesize_remote($remotefile, $timeout = 10)
                                  {
                                      $size       = false;
                                      $parsed_url = self::ParseURLbetter($remotefile);
                                      if ($fp = @fsockopen($parsed_url['host'], $parsed_url['port'], $errno, $errstr, $timeout)) {
                              Severity: Minor
                              Found in phpthumb/phpthumb.functions.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 filedate_remote has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public static function filedate_remote($remotefile, $timeout = 10)
                                  {
                                      $date       = false;
                                      $parsed_url = self::ParseURLbetter($remotefile);
                                      if ($fp = @fsockopen($parsed_url['host'], $parsed_url['port'], $errno, $errstr, $timeout)) {
                              Severity: Minor
                              Found in phpthumb/phpthumb.functions.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 ($imagetypes & IMG_JPG) {
                                                      $gd_info['JPG Support'] = true;
                                                  }
                              Severity: Major
                              Found in phpthumb/phpthumb.functions.php - About 45 mins to fix

                                Method ScaleToFitInBox has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    public static function ScaleToFitInBox($width, $height, $maxwidth = null, $maxheight = null, $allow_enlarge = true, $allow_reduce = true)
                                Severity: Minor
                                Found in phpthumb/phpthumb.functions.php - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                      if ($imagetypes & IMG_WBMP) {
                                                          $gd_info['WBMP Support'] = true;
                                                      }
                                  Severity: Major
                                  Found in phpthumb/phpthumb.functions.php - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                        if ($tempfilename = phpthumb::phpThumb_tempnam()) {
                                                            if ($fp_tempfile = @fopen($tempfilename, 'wb')) {
                                                                fwrite($fp_tempfile, base64_decode('R0lGODlhAQABAIAAAH//AP///ywAAAAAAQABAAACAUQAOw==')); // very simple 1px GIF file base64-encoded as string
                                                                fclose($fp_tempfile);
                                                                $phpthumb_temp = new phpthumb();
                                    Severity: Major
                                    Found in phpthumb/phpthumb.functions.php - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                              switch ($errno) {
                                                                  case 200:
                                                                      // great, continue
                                                                      break;
                                      
                                      
                                      Severity: Major
                                      Found in phpthumb/phpthumb.functions.php - About 45 mins to fix

                                        Avoid deeply nested control flow statements.
                                        Open

                                                            if ($imagetypes & IMG_PNG) {
                                                                $gd_info['PNG Support'] = true;
                                                            }
                                        Severity: Major
                                        Found in phpthumb/phpthumb.functions.php - About 45 mins to fix

                                          Method URLreadFsock has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                          Open

                                              public static function URLreadFsock($host, $file, &$errstr, $successonly = true, $port = -1, $timeout = 10)
                                          Severity: Minor
                                          Found in phpthumb/phpthumb.functions.php - About 45 mins to fix

                                            Avoid deeply nested control flow statements.
                                            Open

                                                                if ($imagetypes & IMG_GIF) {
                                                                    $gd_info['GIF Create Support'] = true;
                                                                }
                                            Severity: Major
                                            Found in phpthumb/phpthumb.functions.php - About 45 mins to fix

                                              Method ImageColorAllocateAlphaSafe has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                              Open

                                                  public static function ImageColorAllocateAlphaSafe(&$gdimg_hexcolorallocate, $R, $G, $B, $alpha = false)
                                              Severity: Minor
                                              Found in phpthumb/phpthumb.functions.php - About 35 mins to fix

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

                                                    public static function ProportionalResize($old_width, $old_height, $new_width = false, $new_height = false)
                                                    {
                                                        $old_aspect_ratio = $old_width / $old_height;
                                                        if (($new_width === false) && ($new_height === false)) {
                                                            return false;
                                                Severity: Minor
                                                Found in phpthumb/phpthumb.functions.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 FunctionIsDisabled has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                Open

                                                    public static function FunctionIsDisabled($function)
                                                    {
                                                        static $DisabledFunctions = null;
                                                        if (null === $DisabledFunctions) {
                                                            $disable_functions_local  = explode(',', strtolower(@ini_get('disable_functions')));
                                                Severity: Minor
                                                Found in phpthumb/phpthumb.functions.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 ImageCopyResampleBicubic has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                Open

                                                    public static function ImageCopyResampleBicubic($dst_img, $src_img, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h)
                                                    {
                                                        // ron at korving dot demon dot nl
                                                        // http://www.php.net/imagecopyresampled
                                                
                                                
                                                Severity: Minor
                                                Found in phpthumb/phpthumb.functions.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 (int)($version1 != $version2);
                                                Severity: Major
                                                Found in phpthumb/phpthumb.functions.php - About 30 mins to fix

                                                  Avoid too many return statements within this method.
                                                  Open

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

                                                    Avoid too many return statements within this method.
                                                    Open

                                                                    return (int)($version1 == $version2);
                                                    Severity: Major
                                                    Found in phpthumb/phpthumb.functions.php - About 30 mins to fix

                                                      Avoid too many return statements within this method.
                                                      Open

                                                              return 1;
                                                      Severity: Major
                                                      Found in phpthumb/phpthumb.functions.php - About 30 mins to fix

                                                        Avoid too many return statements within this method.
                                                        Open

                                                                    return 0;
                                                        Severity: Major
                                                        Found in phpthumb/phpthumb.functions.php - About 30 mins to fix

                                                          Avoid too many return statements within this method.
                                                          Open

                                                                      return -1;
                                                          Severity: Major
                                                          Found in phpthumb/phpthumb.functions.php - About 30 mins to fix

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

                                                                public static function ApacheLookupURIarray($filename)
                                                                {
                                                                    // apache_lookup_uri() only works when PHP is installed as an Apache module.
                                                                    if (PHP_SAPI == 'apache') {
                                                                        //$property_exists_exists = function_exists('property_exists');
                                                            Severity: Minor
                                                            Found in phpthumb/phpthumb.functions.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

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

                                                                        foreach ($phpinfo_array as $line) {
                                                                            $line = trim(strip_tags($line));
                                                                            foreach ($gd_info as $key => $value) {
                                                                                //if (strpos($line, $key) !== false) {
                                                                                if (strpos($line, $key) === 0) {
                                                            Severity: Minor
                                                            Found in phpthumb/phpthumb.functions.php and 1 other location - About 35 mins to fix
                                                            phpthumb/phpthumb.functions.php on lines 165..173

                                                            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

                                                                        foreach ($phpinfo_array as $line) {
                                                                            $line = trim(strip_tags($line));
                                                                            foreach ($exif_info as $key => $value) {
                                                                                if (strpos($line, $key) === 0) {
                                                                                    $newvalue        = trim(str_replace($key, '', $line));
                                                            Severity: Minor
                                                            Found in phpthumb/phpthumb.functions.php and 1 other location - About 35 mins to fix
                                                            phpthumb/phpthumb.functions.php on lines 981..990

                                                            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