rugk/xenforo-threema-gateway

View on GitHub
src/library/ThreemaGateway/Handler/Action/TfaCallback/DeliveryReceipt.php

Summary

Maintainability
A
1 hr
Test Coverage

Function processConfirmRequest has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    protected function processConfirmRequest($confirmRequest, array $processOptions = [])
    {
        if (!parent::processConfirmRequest($confirmRequest, $processOptions)) {
            return false;
        }

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function applyFilter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function applyFilter($filterType, $filterData, $failOnError = true)
    {
        /** @var $success bool */
        $success = true;

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Missing class import via use statement (line '83', column '27').
Open

                throw new XenForo_Exception('Unknown filter type: ' . $filterType);

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

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

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

    protected function applyFilter($filterType, $filterData, $failOnError = true)

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

Avoid unused parameters such as '$confirmRequest'.
Open

    protected function preSaveData(array $confirmRequest, array &$oldProviderData, array &$setData, array $processOptions = [])

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 excessively long class names like ThreemaGateway_Handler_Action_TfaCallback_DeliveryReceipt. Keep class name length under 40.
Open

class ThreemaGateway_Handler_Action_TfaCallback_DeliveryReceipt extends ThreemaGateway_Handler_Action_TfaCallback_Abstract
{
    /**
     * @var int filter because of receipt type
     */

LongClassName

Since: 2.9

Detects when classes or interfaces are declared with excessively long names.

Example

class ATooLongClassNameThatHintsAtADesignProblem {

}

interface ATooLongInterfaceNameThatHintsAtADesignProblem {

}

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

There are no issues that match your filters.

Category
Status