rugk/xenforo-threema-gateway

View on GitHub

Showing 104 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

              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

                    File Callback.php has 286 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    /**
                     * Allows XenForo to receive Threema messages by providing a callback.
                     *
                     * @package ThreemaGateway
                    Severity: Minor
                    Found in src/library/ThreemaGateway/Handler/Action/Callback.php - About 2 hrs to fix

                      ThreemaGateway_Handler_Action_TfaCallback_Abstract has 25 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      abstract class ThreemaGateway_Handler_Action_TfaCallback_Abstract extends ThreemaGateway_Handler_Action_Abstract
                      {
                          /**
                           * @var array Cache of models
                           */
                      Severity: Minor
                      Found in src/library/ThreemaGateway/Handler/Action/TfaCallback/Abstract.php - About 2 hrs to fix

                        Method handleManage has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            final public function handleManage(XenForo_Controller $controller, array $user, array $providerData)
                            {
                                $this->gatewayPermissions->setUserId($user);
                        
                                /** @var XenForo_Input $input */
                        Severity: Major
                        Found in src/library/ThreemaGateway/Tfa/AbstractProvider.php - About 2 hrs to fix

                          Method handleMessageDecline has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private function handleMessageDecline(array &$providerData, array $user, $userIp = null)
                              {
                                  /** @var XenForo_Options $xenOptions */
                                  $xenOptions = XenForo_Application::getOptions();
                                  /** @var int $blockingTime seconds how long users should be blocked */
                          Severity: Major
                          Found in src/library/ThreemaGateway/Tfa/Fast.php - About 2 hrs to fix

                            Function handleManage has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                            Open

                                final public function handleManage(XenForo_Controller $controller, array $user, array $providerData)
                                {
                                    $this->gatewayPermissions->setUserId($user);
                            
                                    /** @var XenForo_Input $input */
                            Severity: Minor
                            Found in src/library/ThreemaGateway/Tfa/AbstractProvider.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

                            Method create has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function create()
                                {
                                    $db = XenForo_Application::get('db');
                            
                                    // set charset
                            Severity: Major
                            Found in src/library/ThreemaGateway/Installer/MessagesDb.php - About 2 hrs to fix

                              Method setDataForRequest has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  protected function setDataForRequest(
                                      array $confirmRequest,
                                      array $setData,
                                      array $processOptions = []
                                  ) {
                              Severity: Major
                              Found in src/library/ThreemaGateway/Handler/Action/TfaCallback/Abstract.php - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language