| Conditions | 7 |
| Paths | 18 |
| Total Lines | 64 |
| Code Lines | 54 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php declare(strict_types=1); |
||
| 40 | function b_marquee_article($limit, $dateFormat, $itemsSize) |
||
| 41 | { |
||
| 42 | global $xoopsDB; |
||
| 43 | // require_once XOOPS_ROOT_PATH . '/modules/marquee/class/Utility.php'; |
||
| 44 | require_once XOOPS_ROOT_PATH . '/modules/article/include/functions.php'; |
||
| 45 | $block = []; |
||
| 46 | $myts = \MyTextSanitizer::getInstance(); |
||
| 47 | static $accessCats; |
||
| 48 | $artConfig = art_load_config(); |
||
| 49 | art_define_url_delimiter(); |
||
| 50 | $select = 'art_id'; |
||
| 51 | $dispTag = ''; |
||
| 52 | $from = ''; |
||
| 53 | $where = ''; |
||
| 54 | $order = 'art_time_publish DESC'; |
||
| 55 | $select .= ', cat_id, art_title, uid, art_time_publish'; |
||
| 56 | if (null === $accessCats) { |
||
| 57 | $permissionHandler = Article\Helper::getInstance()->getHandler('Permission'); |
||
| 58 | $accessCats = $permissionHandler->getCategories('access'); |
||
| 59 | } |
||
| 60 | $allowedCats = $accessCats; |
||
| 61 | $sql = "SELECT $select FROM " . art_DB_prefix('article') . $from; |
||
| 62 | $sql .= ' WHERE cat_id IN (' . implode(',', $allowedCats) . ') AND art_time_publish >0 ' . $where; |
||
| 63 | $sql .= ' ORDER BY ' . $order; |
||
| 64 | $sql .= ' LIMIT 0, ' . $limit; |
||
| 65 | $result = $xoopsDB->query($sql); |
||
| 66 | if (!$xoopsDB->isResultSet($result)) { |
||
| 67 | return false; |
||
| 68 | } |
||
| 69 | $rows = []; |
||
| 70 | $author = []; |
||
| 71 | while (false !== ($row = $xoopsDB->fetchArray($result))) { |
||
| 72 | $rows[] = $row; |
||
| 73 | $author[$row['uid']] = 1; |
||
| 74 | } |
||
| 75 | if (count($rows) < 1) { |
||
| 76 | return false; |
||
| 77 | } |
||
| 78 | $authorName = \XoopsUser::getUnameFromId(array_keys($author)); |
||
| 79 | $arts = []; |
||
| 80 | $uids = []; |
||
| 81 | $cids = []; |
||
| 82 | $articleHandler = Article\Helper::getInstance()->getHandler('Article'); |
||
| 83 | foreach ($rows as $row) { |
||
| 84 | $article = $articleHandler->create(false); |
||
| 85 | $article->assignVars($row); |
||
| 86 | $_art = []; |
||
| 87 | foreach ($row as $tag => $val) { |
||
| 88 | $_art[$tag] = @$article->getVar($tag); |
||
| 89 | } |
||
| 90 | $_art['author'] = $authorName[$row['uid']]; |
||
| 91 | $_art['date'] = $article->getTime($dateFormat); |
||
| 92 | $titlelength = $itemsSize + 3; |
||
| 93 | $_art['title'] = xoops_substr($_art['art_title'], 0, $titlelength); |
||
| 94 | $_art['category'] = ''; |
||
| 95 | $delimiter = '/'; |
||
| 96 | $_art['link'] = '<a href="' . XOOPS_URL . "modules/article/view.article.php$delimiter" . $_art['art_id'] . '/c' . $_art['cat_id'] . '"><strong>' . $_art['art_title'] . '</strong></a>'; |
||
| 97 | $arts[] = $_art; |
||
| 98 | unset($article, $_art); |
||
| 99 | $cids[$row['cat_id']] = 1; |
||
| 100 | } |
||
| 101 | $block = $arts; |
||
| 102 | |||
| 103 | return $block; |
||
| 104 | } |
||
| 105 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths