XoopsModules25x/xoopstube

View on GitHub

Showing 188 of 2,792 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 render has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function render($alphaCount = null, $howmanyother = null)
    {
        $moduleDirName      = \basename(\dirname(__DIR__, 2));
        $moduleDirNameUpper = mb_strtoupper($moduleDirName);
        \xoops_loadLanguage('common', $moduleDirName);
Severity: Minor
Found in class/Common/LetterChoice.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 getLocalAlphabet has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function getLocalAlphabet()
{
    $alphabet = [
        '0',
        '1',
Severity: Minor
Found in language/english/common.php - About 1 hr to fix

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

        public static function convertHtml2text($document)
        {
            // PHP Manual:: function preg_replace
            // $document should contain an HTML document.
            // This will remove HTML tags, javascript sections
    Severity: Minor
    Found in class/Utility.php - About 1 hr to fix

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

      function getXtubeAlphabet()
      {
          $xtubeAlphabet = [
              '0',
              '1',
      Severity: Minor
      Found in language/english/main.php - About 1 hr to fix

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

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

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

              public static function displayIcons($time, $status = 0, $counter = 0)
              {
                  global $xoopsModule;
          
                  $new = '';
          Severity: Minor
          Found in class/Utility.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 getLettersChoice has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function getLettersChoice()
                  {
                      global $xoopsModule;
              
                      $moduleDirName = $xoopsModule->getVar('dirname');
              Severity: Minor
              Found in class/Utility.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 getModuleOption has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function getModuleOption($option, $withCache = true)
                    {
                        global $xoopsModuleConfig, $xoopsModule;
                        $repmodule = self::MODULE_NAME;
                        static $options = [];
                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 xtubeGetVideoPublisher has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                function xtubeGetVideoPublisher($vidid, $publisher, $source = 0)
                {
                    switch ($source) {
                        // Determine if video source YouTube for publisher
                        case 0:
                Severity: Minor
                Found in include/video.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 upload has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function upload($chmod = 0644)
                    {
                        if ('' === $this->uploadDir) {
                            $this->setErrors(\_AM_XOOPSTUBE_NOUPLOADDIR);
                
                
                Severity: Minor
                Found in class/MediaUploader.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 getThumbsTopVideoBlock has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function getThumbsTopVideoBlock($bvidid, $btitle, $bsource, $bpicurl, array $size = [])
                {
                    $thumbb = '';
                    /** @var \XoopsModuleHandler $moduleHandler */
                    $moduleHandler = xoops_getHandler('module');
                Severity: Minor
                Found in blocks/xoopstube_top.php - About 1 hr to fix

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

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

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

                        public static function getAlphaArray()
                        {
                            global $xoopsUser, $xoopsDB, $xoopsModule;
                            $grouppermHandler = \xoops_getHandler('groupperm');
                            $groups           = \is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
                    Severity: Minor
                    Found in class/Utility.php - About 1 hr to fix

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

                      function xoopstube_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

                        Consider simplifying this complex logical expression.
                        Open

                                if ((($published['expired'] && (int)$published['expired'] > \time()) || 0 === (int)$published['expired'])
                                    && ($published['published'] && (int)$published['published'] < \time())
                                    && 0 === (int)$published['offline']) {
                                    $published_status = '<a href="main.php?op=toggle&amp;lid=' . $lid . '&amp;offline=' . (int)$published['offline'] . '"><img src="' . $pathIcon16 . '/1.png' . '"></a>';
                                } elseif (($published['expired'] && (int)$published['expired'] < \time()) && 0 === (int)$published['offline']) {
                        Severity: Critical
                        Found in class/Utility.php - About 1 hr to fix

                          Consider simplifying this complex logical expression.
                          Open

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