rugk/xenforo-threema-gateway

View on GitHub

Showing 104 of 597 total issues

Method createConnectionSettings has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function createConnectionSettings($gatewayId, $gatewaySecret)
    {
        /** @var XenForo_Options $xenOptions */
        $xenOptions = XenForo_Application::getOptions();

Severity: Minor
Found in src/library/ThreemaGateway/Handler/PhpSdk.php - About 1 hr to fix

    Function ReceiveCallback has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var ReceiveCallback = (function () {
        'use strict';
        var me = {};
        var $inputElem;
        var $hiddenElem;
    Severity: Minor
    Found in src/js/ThreemaGateway/options.js - About 1 hr to fix

      Method checkForReceiverCode has 29 lines of code (exceeds 25 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 1 hr to fix

        Method _getExistingData has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function _getExistingData($data)
            {
                // try primary key first
                /** @var string $requestId */
                if ($requestId = $this->_getExistingPrimaryKey($data, 'request_id')) {

          Method queryCredits has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected static function queryCredits(array &$status, array &$extraError)
              {
                  /** @var ThreemaGateway_Handler_Permissions $permissions */
                  $permissions = ThreemaGateway_Handler_Permissions::getInstance();
          
          
          Severity: Minor
          Found in src/library/ThreemaGateway/Option/Status.php - About 1 hr to fix

            Method checkTecRequire has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected static function checkTecRequire(array &$status, array &$extraError)
                {
                    // optional check: HTTPS
                    if (!XenForo_Application::$secure) {
                        $extraError[]['text'] = new XenForo_Phrase('option_threema_gateway_status_no_https');
            Severity: Minor
            Found in src/library/ThreemaGateway/Option/Status.php - About 1 hr to fix

              Function getMessageMetaData has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getMessageMetaData($groupById = false, $ignoreInvalid = true)
                  {
                      /** @var array $limitOptions */
                      $limitOptions = $this->prepareLimitFetchOptions($this->fetchOptions);
              
              
              Severity: Minor
              Found in src/library/ThreemaGateway/Model/Messages.php - About 1 hr 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 processPending has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function processPending(array $processOptions = [])
                  {
                      if (!$this->pendingRequests) {
                          $this->preProcessPending();
                      }
              Severity: Minor
              Found in src/library/ThreemaGateway/Handler/Action/TfaCallback/Abstract.php - About 1 hr 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 getRandomBytes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function getRandomBytes($number)
                  {
                      /** @var string $output */
                      $output = '';
              
              
              Severity: Minor
              Found in src/library/ThreemaGateway/Helper/Random.php - About 1 hr 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 validatePreConditions has 27 lines of code (exceeds 25 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 1 hr to fix

                Method validateRequest has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function validateRequest(&$errorString)
                    {
                        // access token validation (authentication of Gateway server)
                        /** @var XenForo_Options $options */
                        $options = XenForo_Application::getOptions();
                Severity: Minor
                Found in src/library/ThreemaGateway/Handler/Action/Callback.php - About 1 hr to fix

                  Method uninstall has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function uninstall()
                      {
                          // delete throttle table
                          /** @var ThreemaGateway_Installer_ActionThrottle $throttleInstaller */
                          $throttleInstaller = new ThreemaGateway_Installer_ActionThrottle;
                  Severity: Minor
                  Found in src/library/ThreemaGateway/Installer.php - About 1 hr to fix

                    Consider simplifying this complex logical expression.
                    Open

                            if (!$this->input->inRequest('from') ||
                                !$this->input->inRequest('to') ||
                                !$this->input->inRequest('messageId') ||
                                !$this->input->inRequest('date') ||
                                !$this->input->inRequest('nonce') ||
                    Severity: Major
                    Found in src/library/ThreemaGateway/Handler/Action/Callback.php - About 1 hr to fix

                      Function actionTwoStepEnable has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function actionTwoStepEnable()
                          {
                              /** @var XenForo_ControllerResponse_View $parent */
                              $parent = parent::actionTwoStepEnable();
                      
                      
                      Severity: Minor
                      Found in src/library/ThreemaGateway/ControllerPublic/Account.php - About 55 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 triggerVerification has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function triggerVerification($context, array $user, $userIp, array &$providerData)
                          {
                              parent::triggerVerification($context, $user, $userIp, $providerData);
                      
                              // this 2FA mode requires end-to-end encryption
                      Severity: Minor
                      Found in src/library/ThreemaGateway/Tfa/Fast.php - About 55 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 _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

                        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

                          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
                            Severity
                            Category
                            Status
                            Source
                            Language