Conditions | 7 |
Paths | 18 |
Total Lines | 76 |
Code Lines | 53 |
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 |
||
42 | function b_marquee_article($limit, $dateFormat, $itemsSize) |
||
43 | { |
||
44 | global $xoopsDB; |
||
45 | // require_once XOOPS_ROOT_PATH . '/modules/marquee/class/Utility.php'; |
||
46 | require_once XOOPS_ROOT_PATH . '/modules/article/include/functions.php'; |
||
47 | $block = []; |
||
48 | $myts = \MyTextSanitizer::getInstance(); |
||
49 | |||
50 | static $accessCats; |
||
51 | |||
52 | $artConfig = art_load_config(); |
||
53 | art_define_url_delimiter(); |
||
54 | |||
55 | $select = 'art_id'; |
||
56 | $dispTag = ''; |
||
57 | $from = ''; |
||
58 | $where = ''; |
||
59 | $order = 'art_time_publish DESC'; |
||
60 | |||
61 | $select .= ', cat_id, art_title, uid, art_time_publish'; |
||
62 | |||
63 | if (null === $accessCats) { |
||
64 | $permissionHandler = Article\Helper::getInstance()->getHandler('Permission'); |
||
65 | $accessCats = $permissionHandler->getCategories('access'); |
||
66 | } |
||
67 | $allowedCats = $accessCats; |
||
68 | |||
69 | $query = "SELECT $select FROM " . art_DB_prefix('article') . $from; |
||
70 | $query .= ' WHERE cat_id IN (' . implode(',', $allowedCats) . ') AND art_time_publish >0 ' . $where; |
||
71 | $query .= ' ORDER BY ' . $order; |
||
72 | $query .= ' LIMIT 0, ' . $limit; |
||
73 | if (!$result = $xoopsDB->query($query)) { |
||
74 | return false; |
||
75 | } |
||
76 | $rows = []; |
||
77 | $author = []; |
||
78 | while (false !== ($row = $xoopsDB->fetchArray($result))) { |
||
79 | $rows[] = $row; |
||
80 | $author[$row['uid']] = 1; |
||
81 | } |
||
82 | if (count($rows) < 1) { |
||
83 | return false; |
||
84 | } |
||
85 | $authorName = XoopsUser::getUnameFromId(array_keys($author)); |
||
86 | |||
87 | $arts = []; |
||
88 | $uids = []; |
||
89 | $cids = []; |
||
90 | $articleHandler = Article\Helper::getInstance()->getHandler('Article'); |
||
91 | foreach ($rows as $row) { |
||
92 | $article = $articleHandler->create(false); |
||
93 | $article->assignVars($row); |
||
94 | $_art = []; |
||
95 | foreach ($row as $tag => $val) { |
||
96 | $_art[$tag] = @$article->getVar($tag); |
||
97 | } |
||
98 | $_art['author'] = $authorName[$row['uid']]; |
||
99 | |||
100 | $_art['date'] = $article->getTime($dateFormat); |
||
101 | |||
102 | $titlelength = $itemsSize + 3; |
||
103 | $_art['title'] = xoops_substr($_art['art_title'], 0, $titlelength); |
||
104 | |||
105 | $_art['category'] = ''; |
||
106 | |||
107 | $delimiter = '/'; |
||
108 | $_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>'; |
||
109 | |||
110 | $arts[] = $_art; |
||
111 | unset($article, $_art); |
||
112 | $cids[$row['cat_id']] = 1; |
||
113 | } |
||
114 | |||
115 | $block = $arts; |
||
116 | |||
117 | return $block; |
||
118 | } |
||
119 |
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