mambax7/xfaq

View on GitHub

Showing 36 of 48 total issues

Function insert has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
Open

    public function insert(XoopsObject $obj, $force = false, $checkObject = true)
    {
        if ($checkObject !== false) {
            if (!is_object($obj)) {
                var_dump($obj);
Severity: Minor
Found in class/object.php - About 7 hrs to fix

Cognitive Complexity

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

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

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

Further reading

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

    public function getCSS($ws = true)
    {
        if ($ws) {
            $csscode = "<style type=\"text/css\">\n<!--";
        }
Severity: Major
Found in class/menu.php - About 3 hrs to fix

    File object.php has 294 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * ****************************************************************************
     *  - TDMCreate By TDM   - TEAM DEV MODULE FOR XOOPS
     *  - Licence GPL Copyright (c)  (http://www.tdmxoops.net)
    Severity: Minor
    Found in class/object.php - About 3 hrs to fix

      Method insert has 72 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function insert(XoopsObject $obj, $force = false, $checkObject = true)
          {
              if ($checkObject !== false) {
                  if (!is_object($obj)) {
                      var_dump($obj);
      Severity: Major
      Found in class/object.php - About 2 hrs to fix

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

            public function convertResultSet($result, $id_as_key = false, $as_object = true)
            {
                $ret = [];
                while ($myrow = $this->db->fetchArray($result)) {
                    $obj = $this->create(false);
        Severity: Minor
        Found in class/object.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 getForm has 68 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getForm($action = false)
            {
                global $xoopsDB, $xoopsModuleConfig, $xoopsModule;
        
                if ($action === false) {
        Severity: Major
        Found in class/topic.php - About 2 hrs to fix

          Function checkVerXoops has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function checkVerXoops(XoopsModule $module = null, $requiredVer = null)
              {
                  $moduleDirName = basename(dirname(__DIR__));
                  if (null === $module) {
                      $module = XoopsModule::getByDirname($moduleDirName);
          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 getForm has 57 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getForm($action = false)
              {
                  global $xoopsDB, $xoopsModuleConfig;
          
                  if ($action === false) {
          Severity: Major
          Found in class/faq.php - About 2 hrs to fix

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

            function b_xfaq_faq($options)
            {
                require_once XOOPS_ROOT_PATH . '/modules/xfaq/class/faq.php';
                $myts = MyTextSanitizer::getInstance();
            
            
            Severity: Minor
            Found in blocks/blocks_faq.php - About 1 hr to fix

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

                  public function getanswereForm($action = false)
                  {
                      global $xoopsDB, $xoopsModuleConfig;
              
                      if ($action === false) {
              Severity: Minor
              Found in class/faq.php - About 1 hr to fix

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

                    public function getCount($criteria = null)
                    {
                        $field   = '';
                        $groupby = false;
                        if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
                Severity: Minor
                Found in class/object.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 xoops_module_uninstall_xfaq has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                function xoops_module_uninstall_xfaq(XoopsObject $xoopsModule)
                {
                    $module_id       = $xoopsModule->getVar('mid');
                    $module_name     = $xoopsModule->getVar('name');
                    $moduleDirName   = $xoopsModule->getVar('dirname');
                Severity: Minor
                Found in include/uninstall.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 checkVerXoops has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function checkVerXoops(XoopsModule $module = null, $requiredVer = null)
                    {
                        $moduleDirName = basename(dirname(__DIR__));
                        if (null === $module) {
                            $module = XoopsModule::getByDirname($moduleDirName);
                Severity: Minor
                Found in class/utility.php - About 1 hr to fix

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

                  function xfaq_tag_iteminfo(&$items)
                  {
                      if (empty($items) || !is_array($items)) {
                          return false;
                      }
                  Severity: Minor
                  Found in extra/tag/xfaq.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 convertResultSet has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function convertResultSet($result, $id_as_key = false, $as_object = true)
                      {
                          $ret = [];
                          while ($myrow = $this->db->fetchArray($result)) {
                              $obj = $this->create(false);
                  Severity: Minor
                  Found in class/object.php - About 1 hr to fix

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

                        public function getprivacyForm($action = false)
                        {
                            global $xoopsDB;
                    
                            if ($action === false) {
                    Severity: Minor
                    Found in class/faq.php - About 1 hr to fix

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

                          public function getCount($criteria = null)
                          {
                              $field   = '';
                              $groupby = false;
                              if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
                      Severity: Minor
                      Found in class/object.php - About 1 hr to fix

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

                            public function getUserForm($action = false)
                            {
                                global $xoopsDB;
                        
                                if ($action === false) {
                        Severity: Minor
                        Found in class/faq.php - About 1 hr to fix

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

                              public function getList($criteria = null, $limit = 0, $start = 0)
                              {
                                  $ret = [];
                                  if ($criteria == null) {
                                      $criteria = new CriteriaCompo();
                          Severity: Minor
                          Found in class/object.php - About 1 hr to fix

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

                            function xfaq_search($queryarray, $andor, $limit, $offset, $userid)
                            {
                                global $xoopsDB;
                            
                                global $xoopsDB;
                            Severity: Minor
                            Found in include/search.inc.php - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language