mambax7/pedigree

View on GitHub
class/Utility.php

Summary

Maintainability
F
1 wk
Test Coverage

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

<?php

namespace XoopsModules\Pedigree;

/*
Severity: Major
Found in class/Utility.php - About 1 day to fix

    Function createList has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function createList($result, $prefix, $link, $element)
        {
            $helper = XoopsModules\Pedigree\Helper::getInstance();
            require_once $helper->path('include/common.php');
    
    
    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 pups has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function pups($oid, $gender)
        {
            global $numofcolumns, $nummatch, $pages, $columns, $dogs;
            $content = '';
    
    
    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 bas has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function bas($oid, $pa, $ma)
        {
            global $numofcolumns1, $nummatch1, $pages1, $columns1, $dogs1;
            if ('0' == $pa && '0' == $ma) {
                $sqlquery = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' WHERE father = ' . $pa . ' AND mother = ' . $ma . ' AND id != ' . $oid . " AND father != '0' AND mother !='0' ORDER BY pname";
    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

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

    class Utility
    {
        use Common\VersionChecks;    //checkVerXoops, checkVerPhp Traits
    
        use Common\ServerStats;    // getServerStats Trait
    Severity: Minor
    Found in class/Utility.php - About 3 hrs to fix

      Method pups has 84 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function pups($oid, $gender)
          {
              global $numofcolumns, $nummatch, $pages, $columns, $dogs;
              $content = '';
      
      
      Severity: Major
      Found in class/Utility.php - About 3 hrs to fix

        Method createList has 80 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function createList($result, $prefix, $link, $element)
            {
                $helper = XoopsModules\Pedigree\Helper::getInstance();
                require_once $helper->path('include/common.php');
        
        
        Severity: Major
        Found in class/Utility.php - About 3 hrs to fix

          Method bas has 65 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function bas($oid, $pa, $ma)
              {
                  global $numofcolumns1, $nummatch1, $pages1, $columns1, $dogs1;
                  if ('0' == $pa && '0' == $ma) {
                      $sqlquery = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' WHERE father = ' . $pa . ' AND mother = ' . $ma . ' AND id != ' . $oid . " AND father != '0' AND mother !='0' ORDER BY pname";
          Severity: Major
          Found in class/Utility.php - About 2 hrs to fix

            Method createThumbs has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function createThumbs($filename)
                {
                    /*
                        require_once __DIR__ . '/phpthumb/phpthumb.class.php';
                        $thumbnail_widths = array(150, 400);
            Severity: Minor
            Found in class/Utility.php - About 1 hr to fix

              Function createThumbs has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function createThumbs($filename)
                  {
                      /*
                          require_once __DIR__ . '/phpthumb/phpthumb.class.php';
                          $thumbnail_widths = array(150, 400);
              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 uploadPicture has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function uploadPicture($num)
                  {
                      require_once $GLOBALS['xoops']->path('class/uploader.php');
              
                      $num = (int)$num;
              Severity: Minor
              Found in class/Utility.php - About 1 hr to fix

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

                    public static function lettersChoice($myObject, $activeObject, $criteria, $name, $link, $link2 = null)
                    {
                        /** @var \XoopsModules\Pedigree\Helper $helper */
                        $helper = Helper::getInstance();
                        $helper->loadLanguage('main');
                Severity: Minor
                Found in class/Utility.php - About 1 hr to fix

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

                      public static function uploadPicture($num)
                      {
                          require_once $GLOBALS['xoops']->path('class/uploader.php');
                  
                          $num = (int)$num;
                  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 lettersChoice has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public static function lettersChoice($myObject, $activeObject, $criteria, $name, $link, $link2 = null)
                  Severity: Minor
                  Found in class/Utility.php - About 45 mins to fix

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

                        public static function lettersChoice($myObject, $activeObject, $criteria, $name, $link, $link2 = null)
                        {
                            /** @var \XoopsModules\Pedigree\Helper $helper */
                            $helper = Helper::getInstance();
                            $helper->loadLanguage('main');
                    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

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

                            while (false !== ($rowres = $GLOBALS['xoopsDB']->fetchArray($queryresult))) {
                                if (0 == $rowres['roft']) {
                                    $gender = "<img src='assets/images/male.gif'>";
                                } else {
                                    $gender = "<img src='assets/images/female.gif'>";
                    Severity: Major
                    Found in class/Utility.php and 1 other location - About 1 day to fix
                    0old/pedigreeUtilities0.php on lines 360..398

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

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

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

                        public static function createThumbs($filename)
                        {
                            /*
                                require_once __DIR__ . '/phpthumb/phpthumb.class.php';
                                $thumbnail_widths = array(150, 400);
                    Severity: Major
                    Found in class/Utility.php and 1 other location - About 1 day to fix
                    0old/pedigreeUtilities0.php on lines 89..201

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

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

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

                        public static function setMeta($key, $value)
                        {
                            $GLOBALS['xoopsDB'] = \XoopsDatabaseFactory::getDatabaseConnection();
                            if (false !== ($ret = self::getMeta($key))) {
                                $sql = \sprintf('UPDATE `%s` SET metavalue = `%s` WHERE metakey = `%s` ', $GLOBALS['xoopsDB']->prefix('pedigree_meta'), $GLOBALS['xoopsDB']->quoteString($value), $GLOBALS['xoopsDB']->quoteString($key));
                    Severity: Major
                    Found in class/Utility.php and 1 other location - About 5 hrs to fix
                    0old/pedigreeUtilities0.php on lines 888..902

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

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

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

                        public static function getCurrentUrls()
                        {
                            $http        = (false === \mb_strpos(XOOPS_URL, 'https://')) ? 'http://' : 'https://';
                            $phpSelf     = $_SERVER['SCRIPT_NAME'];
                            $httpHost    = $_SERVER['HTTP_HOST'];
                    Severity: Major
                    Found in class/Utility.php and 1 other location - About 4 hrs to fix
                    0old/pedigreeUtilities0.php on lines 936..957

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

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

                            if (0 == $gender) {
                                $sqlquery = 'SELECT d.id AS d_id, d.pname AS d_pname, d.roft AS d_roft, d.* FROM '
                                            . $GLOBALS['xoopsDB']->prefix('pedigree_registry')
                                            . ' d LEFT JOIN '
                                            . $GLOBALS['xoopsDB']->prefix('pedigree_registry')
                    Severity: Major
                    Found in class/Utility.php and 2 other locations - About 3 hrs to fix
                    0old/pedigreeUtilities0.php on lines 224..244
                    include/functions.php on lines 218..238

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

                    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

                            foreach ($alphabet as $letter) {
                                /*
                                            if (isset($countsByLetters[$letter])) {
                                                $letter_array['letter'] = $letter;
                                                $letter_array['count']  = $countsByLetters[$letter];
                    Severity: Major
                    Found in class/Utility.php and 1 other location - About 3 hrs to fix
                    0old/pedigreeUtilities0.php on lines 747..762

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

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

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

                            foreach ($fields as $i => $iValue) {
                                $userField   = new Pedigree\Field($fields[$i], $animal->getConfig());
                                $fieldType   = $userField->getSetting('fieldtype');
                                $fieldObject = new $fieldType($userField, $animal);
                                //create empty string
                    Severity: Major
                    Found in class/Utility.php and 8 other locations - About 3 hrs to fix
                    class/Utility.php on lines 411..431
                    include/functions.php on lines 247..267
                    include/functions.php on lines 332..352
                    add_dog.php on lines 290..310
                    add_dog.php on lines 473..493
                    add_litter.php on lines 285..305
                    add_litter.php on lines 454..474
                    virtual.php on lines 151..171

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

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

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

                            foreach ($fields as $i => $iValue) {
                                $userField   = new Pedigree\Field($fields[$i], $animal->getConfig());
                                $fieldType   = $userField->getSetting('fieldtype');
                                $fieldObject = new $fieldType($userField, $animal);
                                //create empty string
                    Severity: Major
                    Found in class/Utility.php and 8 other locations - About 3 hrs to fix
                    class/Utility.php on lines 324..344
                    include/functions.php on lines 247..267
                    include/functions.php on lines 332..352
                    add_dog.php on lines 290..310
                    add_dog.php on lines 473..493
                    add_litter.php on lines 285..305
                    add_litter.php on lines 454..474
                    virtual.php on lines 151..171

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

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

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

                        public static function hasTable($table)
                        {
                            $bRetVal = false;
                            //Verifies that a MySQL table exists
                            $GLOBALS['xoopsDB'] = \XoopsDatabaseFactory::getDatabaseConnection();
                    Severity: Major
                    Found in class/Utility.php and 1 other location - About 3 hrs to fix
                    0old/pedigreeUtilities0.php on lines 832..851

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

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

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

                        public static function animal_CleanVars(&$global, $key, $default = '', $type = 'int')
                        {
                            switch ($type) {
                                case 'string':
                                    $ret = isset($global[$key]) ? \filter_var($global[$key], \FILTER_SANITIZE_MAGIC_QUOTES) : $default;
                    Severity: Major
                    Found in class/Utility.php and 1 other location - About 2 hrs to fix
                    0old/pedigreeUtilities0.php on lines 610..626

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

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

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

                        public static function getMeta($key)
                        {
                            $GLOBALS['xoopsDB'] = \XoopsDatabaseFactory::getDatabaseConnection();
                            $sql                = \sprintf('SELECT metavalue FROM `%s` WHERE metakey= `%s` ', $GLOBALS['xoopsDB']->prefix('pedigree_meta'), $GLOBALS['xoopsDB']->quoteString($key));
                            $ret                = $GLOBALS['xoopsDB']->query($sql);
                    Severity: Major
                    Found in class/Utility.php and 1 other location - About 2 hrs to fix
                    0old/pedigreeUtilities0.php on lines 863..875

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

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

                            if ('0' == $pa && '0' == $ma) {
                                $sqlquery = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' WHERE father = ' . $pa . ' AND mother = ' . $ma . ' AND id != ' . $oid . " AND father != '0' AND mother !='0' ORDER BY pname";
                            } else {
                                $sqlquery = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' WHERE father = ' . $pa . ' AND mother = ' . $ma . ' AND id != ' . $oid . ' ORDER BY pname';
                            }
                    Severity: Major
                    Found in class/Utility.php and 2 other locations - About 1 hr to fix
                    0old/pedigreeUtilities0.php on lines 325..329
                    include/functions.php on lines 319..323

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

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

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

                        public static function animal_meta_keywords($content)
                        {
                            global $xoTheme;
                            $myts    = \MyTextSanitizer::getInstance();
                            $content = $myts->undoHtmlSpecialChars($myts->displayTarea($content));
                    Severity: Major
                    Found in class/Utility.php and 1 other location - About 1 hr to fix
                    class/Utility.php on lines 816..826

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

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

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

                        public static function animal_meta_description($content)
                        {
                            global $xoTheme;
                            $myts    = \MyTextSanitizer::getInstance();
                            $content = $myts->undoHtmlSpecialChars($myts->displayTarea($content));
                    Severity: Major
                    Found in class/Utility.php and 1 other location - About 1 hr to fix
                    class/Utility.php on lines 800..810

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

                    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 (!empty($field) || '' != $field) {
                                $uploader = new \XoopsMediaUploader($img_dir, $allowed_mimetypes, $max_imgsize, $max_imgwidth, $max_imgheight);
                                $uploader->setPrefix('img');
                                if ($uploader->fetchMedia($field) && $uploader->upload()) {
                                    $photo = $uploader->getSavedFileName();
                    Severity: Major
                    Found in class/Utility.php and 1 other location - About 1 hr to fix
                    0old/pedigreeUtilities0.php on lines 72..83

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

                    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