rugk/xenforo-threema-gateway

View on GitHub

Showing 597 of 597 total issues

Avoid variables with short names like $db. Configured minimum length is 3.
Open

        $db = XenForo_Application::get('db');

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

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

Avoid variables with short names like $db. Configured minimum length is 3.
Open

        $db = XenForo_Application::get('db');

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

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

Avoid variables with short names like $db. Configured minimum length is 3.
Open

        $db = XenForo_Application::get('db');

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

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

Avoid variables with short names like $db. Configured minimum length is 3.
Open

        $db = XenForo_Application::get('db');

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

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

Avoid variables with short names like $db. Configured minimum length is 3.
Open

        $db = XenForo_Application::get('db');

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

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

Avoid variables with short names like $db. Configured minimum length is 3.
Open

        $db = XenForo_Application::get('db');

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

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

Avoid variables with short names like $db. Configured minimum length is 3.
Open

        $db = XenForo_Application::get('db');

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

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

Avoid variables with short names like $db. Configured minimum length is 3.
Open

        $db = XenForo_Application::get('db');

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

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

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

Method checkForDeliveryReceipt has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public static function checkForDeliveryReceipt(ThreemaGateway_Handler_Action_Callback $handler,
                                        Threema\MsgApi\Helpers\ReceiveMessageResult $receiveResult,
                                        Threema\MsgApi\Messages\ThreemaMessage $threemaMsg,
                                        &$output,
                                        &$saveMessage,
Severity: Minor
Found in src/library/ThreemaGateway/Listener/TfaMessageCallback.php - About 45 mins to fix

    Method testCallbackPostSave has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public static function testCallbackPostSave(ThreemaGateway_Handler_Action_Callback $handler,
                                            Threema\MsgApi\Helpers\ReceiveMessageResult $receiveResult,
                                            Threema\MsgApi\Messages\ThreemaMessage $threemaMsg,
                                            &$output,
                                            $messageSaved,
    Severity: Minor
    Found in docs/examples/MessageCallback.php - About 45 mins to fix

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

          final protected function getDefaultThreemaId(array $user)
          {
              /** @var XenForo_Options $options */
              $options = XenForo_Application::getOptions();
              // check for custom user field
      Severity: Minor
      Found in src/library/ThreemaGateway/Tfa/AbstractProvider.php - About 45 mins to fix

      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 validatePreConditions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function validatePreConditions(&$errorString)
          {
              /** @var XenForo_Options $options */
              $options = XenForo_Application::getOptions();
      
      
      Severity: Minor
      Found in src/library/ThreemaGateway/Handler/Action/Callback.php - About 45 mins to fix

      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

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

          public function __construct(ThreemaGateway_Handler_Action_Callback $handler,
                                      Threema\MsgApi\Helpers\ReceiveMessageResult $receiveResult,
                                      Threema\MsgApi\Messages\ThreemaMessage $threemaMsg,
                                      &$output,
                                      &$saveMessage,
      Severity: Minor
      Found in src/library/ThreemaGateway/Handler/Action/TfaCallback/Abstract.php - About 45 mins to fix

        Method checkForReceiverCode has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public static function checkForReceiverCode(ThreemaGateway_Handler_Action_Callback $handler,
                                                Threema\MsgApi\Helpers\ReceiveMessageResult $receiveResult,
                                                Threema\MsgApi\Messages\ThreemaMessage $threemaMsg,
                                                &$output,
                                                &$saveMessage,
        Severity: Minor
        Found in src/library/ThreemaGateway/Listener/TfaMessageCallback.php - About 45 mins to fix

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

              protected function _getExistingData($data)
              {
                  // try primary key first
                  /** @var string $requestId */
                  if ($requestId = $this->_getExistingPrimaryKey($data, 'request_id')) {
          Severity: Minor
          Found in src/library/ThreemaGateway/DataWriter/TfaPendingMessagesConfirmation.php - About 45 mins to fix

          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

          Method testCallbackPreSave has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public static function testCallbackPreSave(ThreemaGateway_Handler_Action_Callback $handler,
                                                  Threema\MsgApi\Helpers\ReceiveMessageResult $receiveResult,
                                                  Threema\MsgApi\Messages\ThreemaMessage $threemaMsg,
                                                  &$output,
                                                  &$saveMessage,
          Severity: Minor
          Found in docs/examples/MessageCallback.php - About 45 mins to fix

            The class ThreemaGateway_Handler_Action_Callback has a coupling between objects value of 18. Consider to reduce the number of dependencies under 13.
            Open

            class ThreemaGateway_Handler_Action_Callback extends ThreemaGateway_Handler_Action_Abstract
            {
                /**
                 * @var string used by strtotime to allow messages sent in the future
                 */

            CouplingBetweenObjects

            Since: 1.1.0

            A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

            Example

            class Foo {
                /**
                 * @var \foo\bar\X
                 */
                private $x = null;
            
                /**
                 * @var \foo\bar\Y
                 */
                private $y = null;
            
                /**
                 * @var \foo\bar\Z
                 */
                private $z = null;
            
                public function setFoo(\Foo $foo) {}
                public function setBar(\Bar $bar) {}
                public function setBaz(\Baz $baz) {}
            
                /**
                 * @return \SplObjectStorage
                 * @throws \OutOfRangeException
                 * @throws \InvalidArgumentException
                 * @throws \ErrorException
                 */
                public function process(\Iterator $it) {}
            
                // ...
            }

            Source https://phpmd.org/rules/design.html#couplingbetweenobjects

            The class ThreemaGateway_Handler_PhpSdk has a coupling between objects value of 15. Consider to reduce the number of dependencies under 13.
            Open

            class ThreemaGateway_Handler_PhpSdk
            {
                /**
                 * @var Singleton
                 */

            CouplingBetweenObjects

            Since: 1.1.0

            A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

            Example

            class Foo {
                /**
                 * @var \foo\bar\X
                 */
                private $x = null;
            
                /**
                 * @var \foo\bar\Y
                 */
                private $y = null;
            
                /**
                 * @var \foo\bar\Z
                 */
                private $z = null;
            
                public function setFoo(\Foo $foo) {}
                public function setBar(\Bar $bar) {}
                public function setBaz(\Baz $baz) {}
            
                /**
                 * @return \SplObjectStorage
                 * @throws \OutOfRangeException
                 * @throws \InvalidArgumentException
                 * @throws \ErrorException
                 */
                public function process(\Iterator $it) {}
            
                // ...
            }

            Source https://phpmd.org/rules/design.html#couplingbetweenobjects

            The class ThreemaGateway_Tfa_AbstractProvider has a coupling between objects value of 19. Consider to reduce the number of dependencies under 13.
            Open

            abstract class ThreemaGateway_Tfa_AbstractProvider extends XenForo_Tfa_AbstractProvider
            {
                /**
                 * Variable, which will be filled with object of the Gateway Permissions class.
                 *

            CouplingBetweenObjects

            Since: 1.1.0

            A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

            Example

            class Foo {
                /**
                 * @var \foo\bar\X
                 */
                private $x = null;
            
                /**
                 * @var \foo\bar\Y
                 */
                private $y = null;
            
                /**
                 * @var \foo\bar\Z
                 */
                private $z = null;
            
                public function setFoo(\Foo $foo) {}
                public function setBar(\Bar $bar) {}
                public function setBaz(\Baz $baz) {}
            
                /**
                 * @return \SplObjectStorage
                 * @throws \OutOfRangeException
                 * @throws \InvalidArgumentException
                 * @throws \ErrorException
                 */
                public function process(\Iterator $it) {}
            
                // ...
            }

            Source https://phpmd.org/rules/design.html#couplingbetweenobjects

            Severity
            Category
            Status
            Source
            Language