railpage/railpagecore

View on GitHub
lib/Locations/Utility/LocationUtility.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid assigning values to variables in if clauses and the like (line '34', column '18').
Open

        public static function getLocationId($slug) {
            
            $Redis = AppCore::GetRedis();
            $Memcached = AppCore::GetMemcached(); 
            $Database = (new AppCore)->getDatabaseConnection(); 

IfStatementAssignment

Since: 2.7.0

Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

Example

class Foo
{
    public function bar($flag)
    {
        if ($foo = 'bar') { // possible typo
            // ...
        }
        if ($baz = 0) { // always false
            // ...
        }
    }
}

Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

Avoid unused local variables such as '$Redis'.
Open

            $Redis = AppCore::GetRedis();

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

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

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

        }

Line indented incorrectly; expected 8 spaces, found 12
Open

            }

Line indented incorrectly; expected 4 spaces, found 8
Open

        }

Line indented incorrectly; expected 4 spaces, found 8
Open

        public static function getLocationId($slug) {

Line indented incorrectly; expected 8 spaces, found 12
Open

            if (!$id = $Memcached->fetch($key)) {

Line indented incorrectly; expected 0 spaces, found 4
Open

    class LocationUtility {

Line indented incorrectly; expected 0 spaces, found 4
Open

    }

There are no issues that match your filters.

Category
Status