railpage/railpagecore

View on GitHub
lib/Images/Utility/Geoplace.php

Summary

Maintainability
B
6 hrs
Test Coverage

Method getRegions has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function getRegions($country = NULL) {
        
        $params = []; 
        $where = [];
        
Severity: Minor
Found in lib/Images/Utility/Geoplace.php - About 1 hr to fix

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

            if (!is_null($country)) {
                $params[] = strtoupper($country);
                $country = " AND country_code = ?";
            }
    Severity: Major
    Found in lib/Images/Utility/Geoplace.php and 1 other location - About 1 hr to fix
    lib/Images/Utility/Geoplace.php on lines 43..46

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

    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 2 locations. Consider refactoring.
    Open

            if (!is_null($region)) {
                $params[] = strtoupper($region);
                $region = " AND region_code = ?";
            }
    Severity: Major
    Found in lib/Images/Utility/Geoplace.php and 1 other location - About 1 hr to fix
    lib/Images/Utility/Geoplace.php on lines 38..41

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

    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 4 locations. Consider refactoring.
    Open

            if (count($where)) {
                $query .= " WHERE " . implode(" AND ", $where); 
            }
    Severity: Major
    Found in lib/Images/Utility/Geoplace.php and 3 other locations - About 1 hr to fix
    lib/GTFS/AU/VIC/PTV/PTV.php on lines 258..260
    lib/Jobs/Jobs.php on lines 100..102
    lib/Locations/Locations.php on lines 243..245

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

    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

            $query = "SELECT g.country_code, g.country_name, g.region_code, g.region_name, g.neighbourhood, g.id, 
                    X(g.point) AS lat, Y(g.point) AS lon, g.timezone, COUNT(*) AS count,
                    GROUP_CONCAT(i.id) AS image_ids, CONCAT('/place?lat=', X(g.point), '&lon=', Y(g.point)) AS url
                FROM image AS i
                LEFT JOIN geoplace AS g ON i.geoplace = g.id
    Severity: Major
    Found in lib/Images/Utility/Geoplace.php and 4 other locations - About 40 mins to fix
    lib/Formatting/Html.php on lines 63..63
    lib/Locos/Locomotive.php on lines 1047..1047
    lib/PrivateMessages/Folder.php on lines 204..211
    lib/SiteMessage/Admin.php on lines 35..35

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

    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 4 locations. Consider refactoring.
    Open

                $return[$row['country_code']]['regions'][$row['region_code']] = array(
                    "region_code" => $row['region_code'],
                    "region_name" => $row['region_name']
                );
    Severity: Major
    Found in lib/Images/Utility/Geoplace.php and 3 other locations - About 30 mins to fix
    lib/Images/Exif.php on lines 294..294
    lib/Images/Provider/FiveHundredPx.php on lines 323..326
    lib/Locos/Utility/LocomotiveUtility.php on lines 445..448

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

    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

    Function closing brace must go on the next line following the body; found 1 blank lines before brace
    Open

        }

    Function closing brace must go on the next line following the body; found 1 blank lines before brace
    Open

        }

    There are no issues that match your filters.

    Category
    Status