railpage/railpagecore

View on GitHub
lib/GTFS/StandardProvider.php

Summary

Maintainability
C
1 day
Test Coverage

Method StopsNearLocation has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function StopsNearLocation($latitude = null, $longitude = null) {
        if ($latitude == null) {
            throw new Exception("Cannot fetch " . __METHOD__ . " - no latitude given");
        }
        
Severity: Minor
Found in lib/GTFS/StandardProvider.php - About 1 hr to fix

    Avoid unused parameters such as '$method'.
    Open

        public function fetch($method, $parameters, $other) {
    Severity: Minor
    Found in lib/GTFS/StandardProvider.php by phpmd

    UnusedFormalParameter

    Since: 0.2

    Avoid passing parameters to methods or constructors and then not using those parameters.

    Example

    class Foo
    {
        private function bar($howdy)
        {
            // $howdy is not used
        }
    }

    Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

    Avoid unused parameters such as '$parameters'.
    Open

        public function fetch($method, $parameters, $other) {
    Severity: Minor
    Found in lib/GTFS/StandardProvider.php by phpmd

    UnusedFormalParameter

    Since: 0.2

    Avoid passing parameters to methods or constructors and then not using those parameters.

    Example

    class Foo
    {
        private function bar($howdy)
        {
            // $howdy is not used
        }
    }

    Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

    Avoid unused parameters such as '$other'.
    Open

        public function fetch($method, $parameters, $other) {
    Severity: Minor
    Found in lib/GTFS/StandardProvider.php by phpmd

    UnusedFormalParameter

    Since: 0.2

    Avoid passing parameters to methods or constructors and then not using those parameters.

    Example

    class Foo
    {
        private function bar($howdy)
        {
            // $howdy is not used
        }
    }

    Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

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

            $this->adapter = new Adapter(array(
                "driver" => "Mysqli",
                "database" => $this->Config->GTFS->PTV->db_name,
                "username" => $this->Config->GTFS->PTV->db_user,
                "password" => $this->Config->GTFS->PTV->db_pass,
    Severity: Major
    Found in lib/GTFS/StandardProvider.php and 2 other locations - About 3 hrs to fix
    lib/GTFS/AU/VIC/PTV/PTV.php on lines 192..198
    lib/GTFS/StandardRoute.php on lines 50..56

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

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

            $query = "SELECT
                        stop_id,
                        stop_name,
                        stop_lat,
                        stop_lon,
    Severity: Major
    Found in lib/GTFS/StandardProvider.php and 2 other locations - About 1 hr to fix
    lib/Images/Utility/Finder.php on lines 282..282
    lib/Jobs/Utility/SlugUtility.php on lines 37..37

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

    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 ($latitude == null) {
                throw new Exception("Cannot fetch " . __METHOD__ . " - no latitude given");
            }
    Severity: Major
    Found in lib/GTFS/StandardProvider.php and 3 other locations - About 1 hr to fix
    lib/GTFS/AU/VIC/PTV/PTV.php on lines 307..309
    lib/GTFS/AU/VIC/PTV/PTV.php on lines 311..313
    lib/GTFS/StandardProvider.php on lines 110..112

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

    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 ($longitude == null) {
                throw new Exception("Cannot fetch " . __METHOD__ . " - no longitude given");
            }
    Severity: Major
    Found in lib/GTFS/StandardProvider.php and 3 other locations - About 1 hr to fix
    lib/GTFS/AU/VIC/PTV/PTV.php on lines 307..309
    lib/GTFS/AU/VIC/PTV/PTV.php on lines 311..313
    lib/GTFS/StandardProvider.php on lines 106..108

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

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

            $result = $this->adapter->query($query, Adapter::QUERY_MODE_EXECUTE); 
    Severity: Major
    Found in lib/GTFS/StandardProvider.php and 6 other locations - About 30 mins to fix
    lib/GTFS/AU/VIC/PTV/PTV.php on lines 344..344
    lib/GTFS/StandardProvider.php on lines 180..180
    lib/GTFS/StandardRoute.php on lines 74..74
    lib/GTFS/StandardRoute.php on lines 103..103
    lib/GTFS/StandardRoute.php on lines 141..141
    lib/GTFS/StandardRoute.php on lines 160..160

    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

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

            $result = $this->adapter->query($query, Adapter::QUERY_MODE_EXECUTE);
    Severity: Major
    Found in lib/GTFS/StandardProvider.php and 6 other locations - About 30 mins to fix
    lib/GTFS/AU/VIC/PTV/PTV.php on lines 344..344
    lib/GTFS/StandardProvider.php on lines 136..136
    lib/GTFS/StandardRoute.php on lines 74..74
    lib/GTFS/StandardRoute.php on lines 103..103
    lib/GTFS/StandardRoute.php on lines 141..141
    lib/GTFS/StandardRoute.php on lines 160..160

    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

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

            $query = sprintf($query, static::DB_PREFIX);
    Severity: Minor
    Found in lib/GTFS/StandardProvider.php and 1 other location - About 30 mins to fix
    lib/Forums/Forums.php on lines 628..628

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

    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

    There are no issues that match your filters.

    Category
    Status