| Conditions | 12 |
| Paths | 27 |
| Total Lines | 62 |
| Code Lines | 48 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 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 |
||
| 85 | function prepareContent($content) |
||
| 86 | { |
||
| 87 | global $xoopsUser, $xoopsConfig; |
||
| 88 | if (is_object($xoopsUser)) { |
||
| 89 | if ($xoopsUser->cleanVars()) { |
||
| 90 | foreach ($xoopsUser->cleanVars as $k => $v) { |
||
| 91 | $content = str_replace('{' . $k . '}', $v, $content); |
||
| 92 | } |
||
| 93 | } |
||
| 94 | } |
||
| 95 | foreach ($xoopsConfig as $k => $v) { |
||
| 96 | if (!is_array($v)) { |
||
| 97 | $content = str_replace('{' . $k . '}', $v, $content); |
||
| 98 | } |
||
| 99 | } |
||
| 100 | $content = str_replace('{banner}', xoops_getbanner(), $content); |
||
| 101 | if (!empty($_GET['busca']) && is_array($_GET['busca'])) { |
||
| 102 | $search_string = MPU_MOD_HIGHLIGHT_SEARCH; |
||
| 103 | $found = 0; |
||
| 104 | $bgs = [ |
||
| 105 | '#ffff66', |
||
| 106 | '#a0ffff', |
||
| 107 | '#99ff99', |
||
| 108 | '#ff9999', |
||
| 109 | '#880000', |
||
| 110 | '#00aa00', |
||
| 111 | '#886800', |
||
| 112 | '#004699', |
||
| 113 | '#990099' |
||
| 114 | ]; |
||
| 115 | $colors = ['black', 'black', 'black', 'black', 'white', 'white', 'white', 'white', 'white']; |
||
| 116 | $ctrl = 0; |
||
| 117 | $busca = array_unique($_GET['busca']); |
||
| 118 | foreach ($busca as $v) { |
||
| 119 | if (false !== stripos(strip_tags($content), $v)) { |
||
| 120 | $cfundo = $bgs[$ctrl]; |
||
| 121 | $ctexto = $colors[$ctrl]; |
||
| 122 | $busca[0] = '~' . $v . '(?![^<]*>)~'; |
||
| 123 | $busca[1] = '~' . strtolower($v) . '(?![^<]*>)~'; |
||
| 124 | $busca[2] = '~' . strtoupper($v) . '(?![^<]*>)~'; |
||
| 125 | $busca[3] = '~' . ucfirst(strtolower($v)) . '(?![^<]*>)~'; |
||
| 126 | $troca[0] = '<span style="font-weight:bold; color: ' . $ctexto . '; background-color: ' . $cfundo . ';">' . $v . '</span>'; |
||
| 127 | $troca[1] = '<span style="font-weight:bold; color: ' . $ctexto . '; background-color: ' . $cfundo . ';">' . strtolower($v) . '</span>'; |
||
| 128 | $troca[2] = '<span style="font-weight:bold; color: ' . $ctexto . '; background-color: ' . $cfundo . ';">' . strtoupper($v) . '</span>'; |
||
| 129 | $troca[3] = '<span style="font-weight:bold; color: ' . $ctexto . '; background-color: ' . $cfundo . ';">' . ucfirst(strtolower($v)) . '</span>'; |
||
| 130 | $content = preg_replace($busca, $troca, $content); |
||
| 131 | $search_string .= '<span style="font-weight:bold; color: ' . $ctexto . '; background-color: ' . $cfundo . ';">' . $v . '</span>, '; |
||
| 132 | $found = 1; |
||
| 133 | if (8 == $ctrl) { |
||
| 134 | $ctrl = 0; |
||
| 135 | } else { |
||
| 136 | ++$ctrl; |
||
| 137 | } |
||
| 138 | } |
||
| 139 | } |
||
| 140 | if ($found) { |
||
| 141 | $search_string = substr($search_string, 0, -2) . '<br><br>'; |
||
| 142 | $content = $search_string . $content; |
||
| 143 | } |
||
| 144 | } |
||
| 145 | |||
| 146 | return $content; |
||
| 147 | } |
||
| 162 |
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