RebelCode/rcmod-wp-bookings-ui

View on GitHub
src/Handlers/BookingsStateStatusesHandler.php

Summary

Maintainability
A
50 mins
Test Coverage

Method __construct has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

        $statuses,
        $screenOptionsKey,
        $screenOptionsFields,
        $screenOptionsEndpoint,
        $screenOptionsCache,
Severity: Major
Found in src/Handlers/BookingsStateStatusesHandler.php - About 50 mins to fix

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

        public function __invoke()
        {
            /* @var $event EventInterface */
            $event = func_get_arg(0);
    
    

    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 excessively long variable names like $screenOptionsEndpoint. Keep variable name length under 20.
    Open

        protected $screenOptionsEndpoint;

    LongVariable

    Since: 0.2

    Detects when a field, formal or local variable is declared with a long name.

    Example

    class Something {
        protected $reallyLongIntName = -3; // VIOLATION - Field
        public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
            $otherReallyLongName = -5; // VIOLATION - Local
            for ($interestingIntIndex = 0; // VIOLATION - For
                 $interestingIntIndex < 10;
                 $interestingIntIndex++ ) {
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#longvariable

    Avoid excessively long variable names like $screenOptionsEndpoint. Keep variable name length under 20.
    Open

            $screenOptionsEndpoint,

    LongVariable

    Since: 0.2

    Detects when a field, formal or local variable is declared with a long name.

    Example

    class Something {
        protected $reallyLongIntName = -3; // VIOLATION - Field
        public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
            $otherReallyLongName = -5; // VIOLATION - Local
            for ($interestingIntIndex = 0; // VIOLATION - For
                 $interestingIntIndex < 10;
                 $interestingIntIndex++ ) {
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#longvariable

    There are no issues that match your filters.

    Category
    Status