mambax7/wflinks

View on GitHub

Showing 155 of 201 total issues

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

function loadTableFromArrayWithReplace($table, $data, $search, $replace)
{
    /** @var \XoopsMySQLDatabase $db */
    $db = \XoopsDatabaseFactory::getDatabaseConnection();

Severity: Minor
Found in testdata/index.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 b_wflinks_top_show has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

function b_wflinks_top_show($options)
{
    $moduleDirName = basename(dirname(__DIR__));
    global $xoopsDB;

Severity: Minor
Found in blocks/wflinks_top.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 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 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 editBlock has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function editBlock($bid)
          {
              require_once __DIR__ . '/admin_header.php';
              //require_once __DIR__ . '/admin_header.php';
              xoops_cp_header();
      Severity: Minor
      Found in admin/blocksadmin.php - About 1 hr to fix

        Method wflinks_notify_iteminfo has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function wflinks_notify_iteminfo($category, $item_id)
        {
            $moduleDirName = basename(dirname(__DIR__));
            global $xoopsModule, $xoopsModuleConfig, $xoopsConfig;
        
        
        Severity: Minor
        Found in include/notification.inc.php - About 1 hr to fix

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

              function cloneBlock($bid)
              {
                  require_once __DIR__ . '/admin_header.php';
                  //require_once __DIR__ . '/admin_header.php';
                  xoops_cp_header();
          Severity: Minor
          Found in admin/blocksadmin.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 createThumb has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function createThumb(
                      $img_width = null,
                      $img_height = null,
                      $img_quality = null,
                      $img_update = null,
              Severity: Minor
              Found in class/ThumbsNails.php - About 1 hr to fix

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

                    public function makeMySelBox($title, $order = '', $preset_id = 0, $none = 0, $sel_name = '', $onchange = '')
                    {
                        if ('' === $sel_name) {
                            $sel_name = $this->id;
                        }
                Severity: Minor
                Found in class/Tree.php - About 1 hr to fix

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

                  function b_sitemap_wflinks()
                  {
                      global $sitemap_configs;
                      global $xoopsDB, $xoopsUser, $xoopsModule;
                      $myts = \MyTextSanitizer::getInstance();
                  Severity: Minor
                  Found in EXTRA/htdocs/modules/sitemap/plugins/wflinks.php - About 1 hr to fix

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

                        public function getDirListAsArray($dirname)
                        {
                            $dirlist = [];
                            if (\is_dir($dirname) && $handle = \opendir($dirname)) {
                                while (false !== ($file = \readdir($handle))) {
                    Severity: Minor
                    Found in class/Lists.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 render has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function render()
                        {
                            $ret = '';
                    
                            if (count($this->_appendix) > 0) {
                    Severity: Minor
                    Found in admin/mygrouppermform.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 render has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function render()
                        {
                            // load all child ids for javascript codes
                            foreach (array_keys($this->_itemTree) as $item_id) {
                                $this->_itemTree[$item_id]['allchild'] = [];
                    Severity: Minor
                    Found in admin/mygrouppermform.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 makeMySelBox has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function makeMySelBox($title, $order = '', $preset_id = 0, $none = 0, $sel_name = '', $onchange = '')
                        {
                            if ('' === $sel_name) {
                                $sel_name = $this->id;
                            }
                    Severity: Minor
                    Found in class/Tree.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 wflinks_tag_iteminfo has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function wflinks_tag_iteminfo(&$items)
                    {
                        $moduleDirName = basename(dirname(__DIR__));
                    
                        if (empty($items) || !is_array($items)) {
                    Severity: Minor
                    Found in class/plugins/plugin.tag.php - About 1 hr to fix

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

                          public function render()
                          {
                              $ret = '';
                      
                              if (count($this->_appendix) > 0) {
                      Severity: Minor
                      Found in admin/mygrouppermform.php - About 1 hr to fix

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

                        function b_wflinks_top_show($options)
                        {
                            $moduleDirName = basename(dirname(__DIR__));
                            global $xoopsDB;
                        
                        
                        Severity: Minor
                        Found in blocks/wflinks_top.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
                              Severity
                              Category
                              Status
                              Source
                              Language