rugk/xenforo-threema-gateway

View on GitHub

Showing 597 of 597 total issues

Method _getFields has 121 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function _getFields()
    {
        return [
            ThreemaGateway_Model_Messages::DB_TABLE_MESSAGES => [
                'message_id' => [
Severity: Major
Found in src/library/ThreemaGateway/DataWriter/Messages.php - About 4 hrs to fix

    Function _preSave has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function _preSave()
        {
            // filter data
            // also uses existing data as a data base as otherwise the main table
            // may also get deleted because of missing message id
    Severity: Minor
    Found in src/library/ThreemaGateway/DataWriter/Messages.php - About 4 hrs 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 AutoTriggerer has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

    var AutoTriggerer = (function(window, document) {
        'use strict';
        var me = {};
        var indicatorElem = '#threemagw_auto_trigger';
        var period = 2000;
    Severity: Minor
    Found in src/js/ThreemaGateway/threematfa.js - About 3 hrs 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

    ThreemaGateway_Tfa_AbstractProvider has 30 functions (exceeds 20 allowed). Consider refactoring.
    Open

    abstract class ThreemaGateway_Tfa_AbstractProvider extends XenForo_Tfa_AbstractProvider
    {
        /**
         * Variable, which will be filled with object of the Gateway Permissions class.
         *
    Severity: Minor
    Found in src/library/ThreemaGateway/Tfa/AbstractProvider.php - About 3 hrs to fix

      Method getMessageDataByType has 91 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getMessageDataByType($messageType, $includeMetaData = true)
          {
              /** @var array $output */
              $output = [];
      
      
      Severity: Major
      Found in src/library/ThreemaGateway/Model/Messages.php - About 3 hrs to fix

        File Messages.php has 310 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
         * Model for messages stored in database.
         *
         * @package ThreemaGateway
        Severity: Minor
        Found in src/library/ThreemaGateway/Model/Messages.php - About 3 hrs to fix

          File AbstractProvider.php has 309 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /**
           * Two factor authentication abstract provider for Threema Gateway.
           *
           * @package ThreemaGateway
          Severity: Minor
          Found in src/library/ThreemaGateway/Tfa/AbstractProvider.php - About 3 hrs to fix

            File Messages.php has 306 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            /**
             * DataWriter for Threema messages.
             *
             * @package ThreemaGateway
            Severity: Minor
            Found in src/library/ThreemaGateway/DataWriter/Messages.php - About 3 hrs to fix

              The class ThreemaGateway_Model_Messages has an overall complexity of 59 which is very high. The configured complexity threshold is 50.
              Open

              class ThreemaGateway_Model_Messages extends XenForo_Model
              {
                  /**
                   * @var string database table (prefix) for messages
                   */

              The class ThreemaGateway_Handler_Action_TfaCallback_Abstract has an overall complexity of 56 which is very high. The configured complexity threshold is 50.
              Open

              abstract class ThreemaGateway_Handler_Action_TfaCallback_Abstract extends ThreemaGateway_Handler_Action_Abstract
              {
                  /**
                   * @var array Cache of models
                   */

              The class ThreemaGateway_Handler_Action_Callback has an overall complexity of 59 which is very high. The configured complexity threshold is 50.
              Open

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

              The class ThreemaGateway_Tfa_AbstractProvider has 12 public methods. Consider refactoring ThreemaGateway_Tfa_AbstractProvider to keep number of public methods under 10.
              Open

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

              TooManyPublicMethods

              Since: 0.1

              A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

              By default it ignores methods starting with 'get' or 'set'.

              Example

              Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

              The class ThreemaGateway_Tfa_Fast has an overall complexity of 61 which is very high. The configured complexity threshold is 50.
              Open

              class ThreemaGateway_Tfa_Fast extends ThreemaGateway_Tfa_AbstractProvider
              {
                  /**
                   * Called when verifying displaying the choose 2FA mode.
                   *

              The class ThreemaGateway_Tfa_AbstractProvider has 26 non-getter- and setter-methods. Consider refactoring ThreemaGateway_Tfa_AbstractProvider to keep number of methods under 25.
              Open

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

              TooManyMethods

              Since: 0.1

              A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

              By default it ignores methods starting with 'get' or 'set'.

              The default was changed from 10 to 25 in PHPMD 2.3.

              Example

              Source https://phpmd.org/rules/codesize.html#toomanymethods

              The class ThreemaGateway_Tfa_AbstractProvider has an overall complexity of 71 which is very high. The configured complexity threshold is 50.
              Open

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

              Function AutoTriggerer has 83 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              var AutoTriggerer = (function(window, document) {
                  'use strict';
                  var me = {};
                  var indicatorElem = '#threemagw_auto_trigger';
                  var period = 2000;
              Severity: Major
              Found in src/js/ThreemaGateway/threematfa.js - About 3 hrs to fix

                File Fast.php has 297 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                /**
                 * Two factor authentication provider for Threema Gateway which sends a
                 * confirmation message.
                 *
                Severity: Minor
                Found in src/library/ThreemaGateway/Tfa/Fast.php - About 3 hrs to fix

                  Function getAllMessageData has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function getAllMessageData(array $metaData, $groupByMessageType = false)
                      {
                          // get grouped messages by type
                          $messageTypes = $this->groupArray($metaData, 'message_type_code');
                          // we always need to do this (regardless of message_type_code) as each
                  Severity: Minor
                  Found in src/library/ThreemaGateway/Model/Messages.php - About 2 hrs 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 renewCache has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function renewCache($userId)
                      {
                          /** @var array $permissions Temporary variable for permissions */
                          $permissions = [];
                  
                  
                  Severity: Minor
                  Found in src/library/ThreemaGateway/Handler/Permissions.php - About 2 hrs 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

                  File Abstract.php has 287 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  /**
                   * 2FA callback actions.
                   *
                   * @package ThreemaGateway
                  Severity: Minor
                  Found in src/library/ThreemaGateway/Handler/Action/TfaCallback/Abstract.php - About 2 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language