mambax7/wflinks

View on GitHub
class/Utility.php

Summary

Maintainability
F
1 wk
Test Coverage

File Utility.php has 1387 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace XoopsModules\Wflinks;

/*
Severity: Major
Found in class/Utility.php - About 3 days to fix

    Method getCountryName has 260 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function getCountryName($countryn)
        {
            $country_array = [
                ''   => 'Unknown',
                '-'  => 'Unknown',
    Severity: Major
    Found in class/Utility.php - About 1 day to fix

      Utility has 42 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Utility extends Common\SysUtility
      {
          //--------------- Custom module methods -----------------------------
          /**
           * getHandler()
      Severity: Minor
      Found in class/Utility.php - About 5 hrs to fix

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

            public static function displayIcons($time, $status = 0, $counter = 0)
            {
                global $xoopsModule;
                /** @var Wflinks\Helper $helper */
                $helper = Wflinks\Helper::getInstance();
        Severity: Minor
        Found in class/Utility.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 getWysiwygForm has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function getWysiwygForm($caption, $name, $value)
            {
                global $xoopsUser, $xoopsModule;
                /** @var Wflinks\Helper $helper */
                $helper = Wflinks\Helper::getInstance();
        Severity: Minor
        Found in class/Utility.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 getSubstring has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function getSubstring($str, $start, $length, $trimmarker = '...')
            {
                $configHandler          = \xoops_getHandler('config');
                $im_multilanguageConfig = $configHandler->getConfigsByCat(IM_CONF_MULILANGUAGE);
        
        
        Severity: Minor
        Found in class/Utility.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 getWysiwygForm has 108 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function getWysiwygForm($caption, $name, $value)
            {
                global $xoopsUser, $xoopsModule;
                /** @var Wflinks\Helper $helper */
                $helper = Wflinks\Helper::getInstance();
        Severity: Major
        Found in class/Utility.php - About 4 hrs to fix

          Method getTotalItems has 67 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function getTotalItems($sel_id = 0, $get_child = 0, $return_sql = 0)
              {
                  global $xoopsDB, $mytree, $_check_array;
          
                  if ($sel_id > 0) {
          Severity: Major
          Found in class/Utility.php - About 2 hrs to fix

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

                public static function getTotalItems($sel_id = 0, $get_child = 0, $return_sql = 0)
                {
                    global $xoopsDB, $mytree, $_check_array;
            
                    if ($sel_id > 0) {
            Severity: Minor
            Found in class/Utility.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 getLetters has 54 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function getLetters()
                {
                    global $xoopsModule;
            
                    $letterchoice = '<div>' . _MD_WFL_BROWSETOTOPIC . '</div>';
            Severity: Major
            Found in class/Utility.php - About 2 hrs to fix

              Method getSubstring has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function getSubstring($str, $start, $length, $trimmarker = '...')
                  {
                      $configHandler          = \xoops_getHandler('config');
                      $im_multilanguageConfig = $configHandler->getConfigsByCat(IM_CONF_MULILANGUAGE);
              
              
              Severity: Minor
              Found in class/Utility.php - About 1 hr to fix

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

                    public static function getBannerFromIdClient($client_id)
                    {
                        ###### Hack by www.stefanosilvestrini.com ######
                        global $xoopsConfig;
                        $db      = \XoopsDatabaseFactory::getDatabaseConnection();
                Severity: Minor
                Found in class/Utility.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 getBannerFromIdBanner has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function getBannerFromIdBanner($banner_id)
                    {
                        ###### Hack by www.stefanosilvestrini.com ######
                        global $xoopsConfig;
                        $db      = \XoopsDatabaseFactory::getDatabaseConnection();
                Severity: Minor
                Found in class/Utility.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 getBannerFromIdClient has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function getBannerFromIdClient($client_id)
                    {
                        ###### Hack by www.stefanosilvestrini.com ######
                        global $xoopsConfig;
                        $db      = \XoopsDatabaseFactory::getDatabaseConnection();
                Severity: Minor
                Found in class/Utility.php - About 1 hr to fix

                  Method getBannerFromIdBanner has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function getBannerFromIdBanner($banner_id)
                      {
                          ###### Hack by www.stefanosilvestrini.com ######
                          global $xoopsConfig;
                          $db      = \XoopsDatabaseFactory::getDatabaseConnection();
                  Severity: Minor
                  Found in class/Utility.php - About 1 hr to fix

                    Method googleCh has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function googleCh($url, $length = null, $init = 0xE6359A60)
                        {
                            if (null === $length) {
                                $length = \count($url);
                            }
                    Severity: Minor
                    Found in class/Utility.php - About 1 hr to fix

                      Method convertHtml2text has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public static function convertHtml2text($document)
                          {
                              $search = [
                                  "'<script[^>]*?>.*?</script>'si", // Strip out javascript
                                  "'<img.*?>'si", // Strip out img tags
                      Severity: Minor
                      Found in class/Utility.php - About 1 hr to fix

                        Method getLinkListBody has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public static function getLinkListBody($published)
                            {
                                global $myts, $imageArray, $xoopsModule;
                                /** @var Wflinks\Helper $helper */
                                $helper = Wflinks\Helper::getInstance();
                        Severity: Minor
                        Found in class/Utility.php - About 1 hr to fix

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

                              public static function displayIcons($time, $status = 0, $counter = 0)
                              {
                                  global $xoopsModule;
                                  /** @var Wflinks\Helper $helper */
                                  $helper = Wflinks\Helper::getInstance();
                          Severity: Minor
                          Found in class/Utility.php - About 1 hr to fix

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

                                public static function convertOrderByOut($orderby)
                                {
                                    if ('title ASC' === $orderby) {
                                        $orderby = 'titleA';
                                    }
                            Severity: Minor
                            Found in class/Utility.php - About 1 hr to fix

                              Consider simplifying this complex logical expression.
                              Open

                                      if (0 == $published['offline']
                                          && ($published['published'] && $published['published'] < \time())
                                          && (($published['expired'] && $published['expired'] > \time()) || 0 == $published['expired'])) {
                                          $published_status = $imageArray['online'];
                                      } elseif (0 == $published['offline'] && ($published['expired'] && $published['expired'] < \time())) {
                              Severity: Critical
                              Found in class/Utility.php - About 1 hr to fix

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

                                    public static function convertOrderByIn($orderby)
                                    {
                                        switch (\trim($orderby)) {
                                            case 'titleA':
                                                $orderby = 'title ASC';
                                Severity: Minor
                                Found in class/Utility.php - About 1 hr to fix

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

                                      public static function convertOrderByOut($orderby)
                                      {
                                          if ('title ASC' === $orderby) {
                                              $orderby = 'titleA';
                                          }
                                  Severity: Minor
                                  Found in class/Utility.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 convertOrderByIn has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      public static function convertOrderByIn($orderby)
                                      {
                                          switch (\trim($orderby)) {
                                              case 'titleA':
                                                  $orderby = 'title ASC';
                                  Severity: Minor
                                  Found in class/Utility.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 convertOrderByTrans has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public static function convertOrderByTrans($orderby)
                                      {
                                          if ('hits ASC' === $orderby) {
                                              $orderbyTrans = _MD_WFL_POPULARITYLTOM;
                                          }
                                  Severity: Minor
                                  Found in class/Utility.php - About 1 hr to fix

                                    Method uploadFiles has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        public static function uploadFiles(
                                            $FILES,
                                            $uploaddir = 'uploads',
                                            $allowed_mimetypes = '',
                                            $redirecturl = 'index.php',
                                    Severity: Minor
                                    Found in class/Utility.php - About 1 hr to fix

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

                                          public static function mix($a, $b, $c)
                                          {
                                              $a -= $b;
                                              $a -= $c;
                                              $a ^= static::fillZeroes($c, 13);
                                      Severity: Minor
                                      Found in class/Utility.php - About 1 hr to fix

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

                                            public static function uploadFiles(
                                                $FILES,
                                                $uploaddir = 'uploads',
                                                $allowed_mimetypes = '',
                                                $redirecturl = 'index.php',
                                        Severity: Minor
                                        Found in class/Utility.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 convertOrderByTrans has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                            public static function convertOrderByTrans($orderby)
                                            {
                                                if ('hits ASC' === $orderby) {
                                                    $orderbyTrans = _MD_WFL_POPULARITYLTOM;
                                                }
                                        Severity: Minor
                                        Found in class/Utility.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 uploadFiles has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                        Open

                                                $FILES,
                                                $uploaddir = 'uploads',
                                                $allowed_mimetypes = '',
                                                $redirecturl = 'index.php',
                                                $num = 0,
                                        Severity: Major
                                        Found in class/Utility.php - About 50 mins to fix

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

                                              public static function pagerank($url)
                                              {
                                                  $pagerank = '';
                                                  $ch       = '6' . static::googleCh(static::strord('info:' . $url));
                                                  $fp       = \fsockopen('www.google.com', 80, $errno, $errstr, 30);
                                          Severity: Minor
                                          Found in class/Utility.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

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

                                              public static function getHandler($name, $optional = false)
                                              {
                                                  global $handlers, $xoopsModule;
                                          
                                                  $name = mb_strtolower(\trim($name));
                                          Severity: Minor
                                          Found in class/Utility.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 getForum has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                              public static function getForum($forumid)
                                              {
                                                  global $xoopsDB, $xoopsConfig;
                                          
                                                  echo "<select name='forumid'>";
                                          Severity: Minor
                                          Found in class/Utility.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 isNewImage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                              public static function isNewImage($published)
                                              {
                                                  global $xoopsModule, $xoopsDB;
                                          
                                                  $oneday    = (\time() - (86400 * 1));
                                          Severity: Minor
                                          Found in class/Utility.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 getLinkListBody has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                              public static function getLinkListBody($published)
                                              {
                                                  global $myts, $imageArray, $xoopsModule;
                                                  /** @var Wflinks\Helper $helper */
                                                  $helper = Wflinks\Helper::getInstance();
                                          Severity: Minor
                                          Found in class/Utility.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 ($htmlbanner) {
                                                          $bannerobject = $htmlcode;
                                                      } else {
                                                          $bannerobject = '<div align="center"><a href="' . XOOPS_URL . '/banners.php?op=click&bid=' . $bid . '" target="_blank">';
                                                          if (false !== mb_stripos($imageurl, '.swf')) {
                                          Severity: Major
                                          Found in class/Utility.php and 1 other location - About 2 hrs to fix
                                          class/Utility.php on lines 1585..1605

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

                                          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 ($htmlbanner) {
                                                          $bannerobject = $htmlcode;
                                                      } else {
                                                          $bannerobject = '<div align="center"><a href="' . XOOPS_URL . '/banners.php?op=click&bid=' . $bid . '" target="_blank">';
                                                          if (false !== mb_stripos($imageurl, '.swf')) {
                                          Severity: Major
                                          Found in class/Utility.php and 1 other location - About 2 hrs to fix
                                          class/Utility.php on lines 1524..1544

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

                                          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 ($imptotal == $impmade) {
                                                          $newid = $db->genId($db->prefix('bannerfinish') . '_bid_seq');
                                                          $sql   = \sprintf('INSERT INTO `%s` (bid, cid, impressions, clicks, datestart, dateend) VALUES (%u, %u, %u, %u, %u, %u)', $db->prefix('bannerfinish'), $newid, $cid, $impmade, $clicks, $date, \time());
                                                          $db->queryF($sql);
                                                          $db->queryF(\sprintf('DELETE FROM `%s` WHERE bid = %u', $db->prefix('banner'), $bid));
                                          Severity: Major
                                          Found in class/Utility.php and 1 other location - About 1 hr to fix
                                          class/Utility.php on lines 1579..1584

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

                                          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 ($imptotal == $impmade) {
                                                          $newid = $db->genId($db->prefix('bannerfinish') . '_bid_seq');
                                                          $sql   = \sprintf('INSERT INTO `%s` (bid, cid, impressions, clicks, datestart, dateend) VALUES (%u, %u, %u, %u, %u, %u)', $db->prefix('bannerfinish'), $newid, $cid, $impmade, $clicks, $date, \time());
                                                          $db->queryF($sql);
                                                          $db->queryF(\sprintf('DELETE FROM `%s` WHERE bid = %u', $db->prefix('banner'), $bid));
                                          Severity: Major
                                          Found in class/Utility.php and 1 other location - About 1 hr to fix
                                          class/Utility.php on lines 1518..1523

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

                                          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