Dhii/wp-events

View on GitHub
src/WordPress/WpHandlerWrapperCacheTrait.php

Summary

Maintainability
A
0 mins
Test Coverage

The method _createWpHandlerWrapper has a boolean flag argument $throwOnPropStop, which is a certain sign of a Single Responsibility Principle violation.
Open

    abstract protected function _createWpHandlerWrapper($name, $callback, $throwOnPropStop = false);

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

The '_getThrowOnPropStop()' method which returns a boolean should be named 'is...()' or 'has...()'
Open

    abstract protected function _getThrowOnPropStop();

BooleanGetMethodName

Since: 0.2

Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

Example

class Foo {
    /**
     * @return boolean
     */
    public function getFoo() {} // bad
    /**
     * @return bool
     */
    public function isFoo(); // ok
    /**
     * @return boolean
     */
    public function getFoo($bar); // ok, unless checkParameterizedMethods=true
}

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

The method _getThrowOnPropStop is not named in camelCase.
Open

    abstract protected function _getThrowOnPropStop();

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method _createWpHandlerWrapper is not named in camelCase.
Open

    abstract protected function _createWpHandlerWrapper($name, $callback, $throwOnPropStop = false);

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method _hashWpHandler is not named in camelCase.
Open

    abstract protected function _hashWpHandler($name, $handler);

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method _getWpHandlerWrapper is not named in camelCase.
Open

    protected function _getWpHandlerWrapper($name, $callback)
    {
        $cbHash = $this->_hashWpHandler($name, $callback);

        // Create if not exists

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

There are no issues that match your filters.

Category
Status