rugk/xenforo-threema-gateway

View on GitHub

Showing 104 of 597 total issues

Method processMessage has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function processMessage($downloadPath, $debugMode = false)
    {
        /** @var string $output */
        $output = '';

Severity: Major
Found in src/library/ThreemaGateway/Handler/Action/Callback.php - About 2 hrs to fix

    Function getMessageDataByType has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getMessageDataByType($messageType, $includeMetaData = true)
        {
            /** @var array $output */
            $output = [];
    
    
    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

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

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

          protected function _getExistingData($data)
          {
              /** @var string $messageId */
              if (!$messageId = $this->_getExistingPrimaryKey($data, 'message_id')) {
                  return false;
      Severity: Minor
      Found in src/library/ThreemaGateway/DataWriter/Messages.php - About 1 hr to fix

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

          Method install has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function install($installedAddon)
              {
                  /** @var array $providerInstaller An array with the models of all providers */
                  $providerInstaller = self::getProviderInstaller();
                  // check requirements of Gateway
          Severity: Minor
          Found in src/library/ThreemaGateway/Installer.php - About 1 hr to fix

            Method verifyFromInput has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function verifyFromInput($context, XenForo_Input $input, array $user, array &$providerData)
                {
                    /** @var bool $result from parent, for error checking */
                    $result = parent::verifyFromInput($context, $input, $user, $providerData);
            
            
            Severity: Minor
            Found in src/library/ThreemaGateway/Tfa/Fast.php - About 1 hr to fix

              Method getFileList has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function getFileList($mimeType = null, $fileType = null, $threemaId = null, $queryMetaData = true)
                  {
                      $this->initiate();
                      $model = XenForo_Model::create('ThreemaGateway_Model_Messages');
              
              
              Severity: Minor
              Found in src/library/ThreemaGateway/Handler/Action/Receiver.php - About 1 hr to fix

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

                    protected function _getFields()
                    {
                        return [
                            ThreemaGateway_Model_TfaPendingMessagesConfirmation::DB_TABLE => [
                                'request_id' => [

                  Method renderHtml has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function renderHtml(XenForo_View $view, $fieldPrefix, array $preparedOption, $canEdit)
                      {
                          /** @var array $status */
                          $status = ['libsodium', 'libsodiumphp', 'phpsdk', 'credits'];
                          /** @var array $extraError */
                  Severity: Minor
                  Found in src/library/ThreemaGateway/Option/Status.php - About 1 hr to fix

                    Function getFileList has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function getFileList($mimeType = null, $fileType = null, $threemaId = null, $queryMetaData = true)
                        {
                            $this->initiate();
                            $model = XenForo_Model::create('ThreemaGateway_Model_Messages');
                    
                    
                    Severity: Minor
                    Found in src/library/ThreemaGateway/Handler/Action/Receiver.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 isReady has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function isReady()
                        {
                            // basic check
                            if (!$this->isAvaliable()) {
                                return false;
                    Severity: Minor
                    Found in src/library/ThreemaGateway/Handler/Settings.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 handleMessageDecline has a Cognitive Complexity of 12 (exceeds 5 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: Minor
                    Found in src/library/ThreemaGateway/Tfa/Fast.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 verifyFromInput has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function verifyFromInput($context, XenForo_Input $input, array $user, array &$providerData)
                        {
                            /** @var bool $result from parent, for error checking */
                            $result = parent::verifyFromInput($context, $input, $user, $providerData);
                    
                    
                    Severity: Minor
                    Found in src/library/ThreemaGateway/Tfa/Fast.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 triggerVerification has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function triggerVerification($context, array $user, $userIp, array &$providerData)
                        {
                            parent::triggerVerification($context, $user, $userIp, $providerData);
                    
                            if (!$providerData) {
                    Severity: Minor
                    Found in src/library/ThreemaGateway/Tfa/Conventional.php - About 1 hr to fix

                      Function checkTecRequire has a Cognitive Complexity of 11 (exceeds 5 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

                      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 getAllMessageData has 30 lines of code (exceeds 25 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 1 hr to fix

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

                            protected function saveMessage(
                                Threema\MsgApi\Helpers\ReceiveMessageResult $receiveResult,
                                Threema\MsgApi\Messages\ThreemaMessage $threemaMsg
                            ) {
                                $dataWriter = XenForo_DataWriter::create('ThreemaGateway_DataWriter_Messages');
                        Severity: Minor
                        Found in src/library/ThreemaGateway/Handler/Action/Callback.php - About 1 hr to fix

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

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

                                protected function getLogData(
                                    Threema\MsgApi\Helpers\ReceiveMessageResult $receiveResult,
                                    Threema\MsgApi\Messages\ThreemaMessage $threemaMsg
                                ) {
                                    $eol = PHP_EOL;
                            Severity: Minor
                            Found in src/library/ThreemaGateway/Handler/Action/Callback.php - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language