railpage/railpagecore

View on GitHub
lib/Notifications/Utility/PushUtility.php

Summary

Maintainability
A
0 mins
Test Coverage

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

        public static function getUserIdFromRegistrationId($registration_id) {
            
            $Database = AppCore::GetDatabase();
            $Memcached = AppCore::GetMemcached(); 
            

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

The parameter $User is not named in camelCase.
Open

        public static function getCurrentNotification($User) {
            if ($User instanceof User) {
                $User = $User->id;
            }
            

CamelCaseParameterName

Since: 0.2

It is considered best practice to use the camelCase notation to name parameters.

Example

class ClassName {
    public function doSomething($user_name) {
    }
}

Source

The parameter $registration_id is not named in camelCase.
Open

        public static function getUserIdFromRegistrationId($registration_id) {
            
            $Database = AppCore::GetDatabase();
            $Memcached = AppCore::GetMemcached(); 
            

CamelCaseParameterName

Since: 0.2

It is considered best practice to use the camelCase notation to name parameters.

Example

class ClassName {
    public function doSomething($user_name) {
    }
}

Source

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 2 blank lines before brace
Open

        }

Line indented incorrectly; expected 4 spaces, found 8
Open

        }

Line indented incorrectly; expected 0 spaces, found 4
Open

    class PushUtility {

Line indented incorrectly; expected 8 spaces, found 12
Open

            }

Line indented incorrectly; expected 4 spaces, found 8
Open

        public static function getCurrentNotification($User) {

Line indented incorrectly; expected 4 spaces, found 8
Open

        }

Line indented incorrectly; expected 8 spaces, found 12
Open

            if ($User instanceof User) {

Line indented incorrectly; expected 8 spaces, found 12
Open

            }

Line indented incorrectly; expected 4 spaces, found 8
Open

        public static function getUserIdFromRegistrationId($registration_id) {

Line indented incorrectly; expected 0 spaces, found 4
Open

    }

Line indented incorrectly; expected 8 spaces, found 12
Open

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

There are no issues that match your filters.

Category
Status