mambax7/alumni-26x

View on GitHub
search.php

Summary

Maintainability
A
3 hrs
Test Coverage

Identical blocks of code found in 2 locations. Consider refactoring.
Open

                if (!preg_match("/^http[s]*:\/\//i", $results[$i]['link'])) {
                    $res[$i]['link'] = $xoops->url('modules/' . $module->getVar('dirname') . '/' . $results[$i]['link']);
                } else {
                    $res[$i]['link'] = $results[$i]['link'];
                }
Severity: Minor
Found in search.php and 1 other location - About 55 mins to fix
search.php on lines 172..176

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 98.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

                    if (!preg_match("/^http[s]*:\/\//i", $results[$i]['link'])) {
                        $res[$i]['link'] = $xoops->url('modules/' . $module->getVar('dirname') . '/' . $results[$i]['link']);
                    } else {
                        $res[$i]['link'] = $results[$i]['link'];
                    }
Severity: Minor
Found in search.php and 1 other location - About 55 mins to fix
search.php on lines 255..259

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 98.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

            if (!empty($by_cat)) {
                $cat_name                  = '';
                $alumni_categories_Handler = $xoops->getModuleHandler('category', 'alumni');
                $catObj                    = $alumni_categories_Handler->get($by_cat);
                $cat_name                  = $catObj->getVar('title');
Severity: Minor
Found in search.php and 1 other location - About 45 mins to fix
search.php on lines 239..246

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 95.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

            if (!empty($by_cat)) {
                $cat_name                  = '';
                $alumni_categories_Handler = $xoops->getModuleHandler('category', 'alumni');
                $catObj                    = $alumni_categories_Handler->get($by_cat);
                $cat_name                  = $catObj->getVar('title');
Severity: Minor
Found in search.php and 1 other location - About 45 mins to fix
search.php on lines 152..159

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 95.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Line exceeds 120 characters; contains 171 characters
Open

                    $res[$i]['title_highligh'] = preg_replace($queries_pattern, "<span class='searchHighlight'>$1</span>", $myts->htmlSpecialChars($results[$i]['title']));
Severity: Minor
Found in search.php by phpcodesniffer

Line exceeds 120 characters; contains 134 characters
Open

                if (XoopsLoad::fileExists($image = $xoops->path('modules/' . $module->getVar('dirname') . '/icons/logo_large.png'))) {
Severity: Minor
Found in search.php by phpcodesniffer

Line exceeds 120 characters; contains 156 characters
Open

                    $search_url                         = XOOPS_URL . '/modules/alumni/search.php?query=' . urlencode(stripslashes(implode(' ', $queries)));
Severity: Minor
Found in search.php by phpcodesniffer

Line exceeds 120 characters; contains 124 characters
Open

            $search_url = XOOPS_URL . '/modules/alumni/search.php?query=' . urlencode(stripslashes(implode(' ', $queries)));
Severity: Minor
Found in search.php by phpcodesniffer

Line exceeds 120 characters; contains 145 characters
Open

        $xoops->tpl()->assign('ignored_words', sprintf(XoopsLocale::F_KEYWORDS_SHORTER_THAN_WILL_BE_IGNORED, $search->getConfig('keyword_min')));
Severity: Minor
Found in search.php by phpcodesniffer

Line exceeds 120 characters; contains 171 characters
Open

                    $res[$i]['title_highligh'] = preg_replace($queries_pattern, "<span class='searchHighlight'>$1</span>", $myts->htmlSpecialChars($results[$i]['title']));
Severity: Minor
Found in search.php by phpcodesniffer

Line exceeds 120 characters; contains 175 characters
Open

                $res[$i]['content'] = empty($results[$i]['content']) ? '' : preg_replace($queries_pattern, "<span class='searchHighlight'>$1</span>", $results[$i]['content']);
Severity: Minor
Found in search.php by phpcodesniffer

Line exceeds 120 characters; contains 136 characters
Open

            $xoops->redirect('index.php', 2, sprintf(XoopsLocale::EF_KEYWORDS_MUST_BE_GREATER_THAN, $search->getConfig('keyword_min')));
Severity: Minor
Found in search.php by phpcodesniffer

Line exceeds 120 characters; contains 125 characters
Open

                        $res[$i]['link'] = $xoops->url('modules/' . $module->getVar('dirname') . '/' . $results[$i]['link']);
Severity: Minor
Found in search.php by phpcodesniffer

Line exceeds 120 characters; contains 122 characters
Open

                $xoops->tpl()->assign('sr_showing', sprintf(XoopsLocale::F_SHOWING_RESULTS, $start + 1, $start + $count));
Severity: Minor
Found in search.php by phpcodesniffer

Line exceeds 120 characters; contains 179 characters
Open

                    $res[$i]['content'] = empty($results[$i]['content']) ? '' : preg_replace($queries_pattern, "<span class='searchHighlight'>$1</span>", $results[$i]['content']);
Severity: Minor
Found in search.php by phpcodesniffer

Line exceeds 120 characters; contains 134 characters
Open

                    $res[$i]['time']    = !empty($results[$i]['time']) ? XoopsLocale::formatTimestamp((int)$results[$i]['time']) : '';
Severity: Minor
Found in search.php by phpcodesniffer

Line exceeds 120 characters; contains 123 characters
Open

                    $res[$i]['image'] = $xoops->url('modules/' . $module->getVar('dirname') . '/' . $results[$i]['image']);
Severity: Minor
Found in search.php by phpcodesniffer

Line exceeds 120 characters; contains 143 characters
Open

                $res[$i]['time']    = !empty($results[$i]['time']) ? ' (' . XoopsLocale::formatTimestamp((int)$results[$i]['time']) . ')' : '';
Severity: Minor
Found in search.php by phpcodesniffer

Line exceeds 120 characters; contains 136 characters
Open

            $xoops->redirect('index.php', 2, sprintf(XoopsLocale::EF_KEYWORDS_MUST_BE_GREATER_THAN, $search->getConfig('keyword_min')));
Severity: Minor
Found in search.php by phpcodesniffer

Line exceeds 120 characters; contains 121 characters
Open

                    $res[$i]['link'] = $xoops->url('modules/' . $module->getVar('dirname') . '/' . $results[$i]['link']);
Severity: Minor
Found in search.php by phpcodesniffer

There are no issues that match your filters.

Category
Status