mambax7/publisher

View on GitHub
item.php

Summary

Maintainability
B
6 hrs
Test Coverage

File item.php has 261 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php declare(strict_types=1);
/*
 You may not change or alter any portion of this comment or credits
 of supporting developers from this source code or any supporting source code
 which is considered copyrighted (c) material of the original comment or credit authors.
Severity: Minor
Found in item.php - About 2 hrs to fix

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

    switch ($helper->getConfig('format_order_by')) {
        case 'title':
            $sort  = 'title';
            $order = 'ASC';
            break;
    Severity: Major
    Found in item.php and 2 other locations - About 2 hrs to fix
    category.php on lines 81..110
    index.php on lines 151..180

    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 141.

    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

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

            if ($comments > 0) {
                //shows 1 comment instead of 1 comm. if comments ==1
                //langugage file modified accordingly
                if (1 == $comments) {
                    $theItem['comments'] = '&nbsp;' . _MD_PUBLISHER_ONECOMMENT . '&nbsp;';
    Severity: Major
    Found in item.php and 4 other locations - About 55 mins to fix
    blocks/items_new.php on lines 97..107
    blocks/items_random_item.php on lines 81..91
    blocks/items_recent.php on lines 102..112
    blocks/latest_news.php on lines 212..222

    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

    Only one argument is allowed per line in a multi-line function call
    Open

        'sectionname', $helper->getModule()
    Severity: Minor
    Found in item.php by phpcodesniffer

    Multi-line function call not indented correctly; expected 8 spaces but found 12
    Open

                $helper->getModule()
    Severity: Minor
    Found in item.php by phpcodesniffer

    Multi-line function call not indented correctly; expected 4 spaces but found 8
    Open

            )
    Severity: Minor
    Found in item.php by phpcodesniffer

    There are no issues that match your filters.

    Category
    Status