rugk/xenforo-threema-gateway

View on GitHub

Showing 597 of 597 total issues

Avoid excessively long class names like ThreemaGateway_Listener_LoadClassController. Keep class name length under 40.
Open

class ThreemaGateway_Listener_LoadClassController
{
    /**
     * Extent XenForo's controllers.
     *

LongClassName

Since: 2.9

Detects when classes or interfaces are declared with excessively long names.

Example

class ATooLongClassNameThatHintsAtADesignProblem {

}

interface ATooLongInterfaceNameThatHintsAtADesignProblem {

}

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

Avoid excessively long class names like ThreemaGateway_Handler_Action_GatewayServer. Keep class name length under 40.
Open

class ThreemaGateway_Handler_Action_GatewayServer extends ThreemaGateway_Handler_Action_Abstract
{
    /**
     * Returns the Threema ID associated to a phone number.
     *

LongClassName

Since: 2.9

Detects when classes or interfaces are declared with excessively long names.

Example

class ATooLongClassNameThatHintsAtADesignProblem {

}

interface ATooLongInterfaceNameThatHintsAtADesignProblem {

}

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

Avoid excessively long class names like ThreemaGateway_Handler_Action_TfaCallback_Abstract. Keep class name length under 40.
Open

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

LongClassName

Since: 2.9

Detects when classes or interfaces are declared with excessively long names.

Example

class ATooLongClassNameThatHintsAtADesignProblem {

}

interface ATooLongInterfaceNameThatHintsAtADesignProblem {

}

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

Avoid excessively long class names like ThreemaGateway_Handler_Action_TfaCallback_TextMessage. Keep class name length under 40.
Open

class ThreemaGateway_Handler_Action_TfaCallback_TextMessage extends ThreemaGateway_Handler_Action_TfaCallback_Abstract
{
    /**
     * @var int replace chars in the string
     */

LongClassName

Since: 2.9

Detects when classes or interfaces are declared with excessively long names.

Example

class ATooLongClassNameThatHintsAtADesignProblem {

}

interface ATooLongInterfaceNameThatHintsAtADesignProblem {

}

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

Avoid excessively long class names like ThreemaGateway_Handler_Action_TfaCallback_DeliveryReceipt. Keep class name length under 40.
Open

class ThreemaGateway_Handler_Action_TfaCallback_DeliveryReceipt extends ThreemaGateway_Handler_Action_TfaCallback_Abstract
{
    /**
     * @var int filter because of receipt type
     */

LongClassName

Since: 2.9

Detects when classes or interfaces are declared with excessively long names.

Example

class ATooLongClassNameThatHintsAtADesignProblem {

}

interface ATooLongInterfaceNameThatHintsAtADesignProblem {

}

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

Avoid excessively long class names like ThreemaGateway_Handler_Action_KeyConverter. Keep class name length under 40.
Open

class ThreemaGateway_Handler_Action_KeyConverter extends ThreemaGateway_Handler_Action_Abstract
{
    /**
     * Converts a key from hex to binary format.
     *

LongClassName

Since: 2.9

Detects when classes or interfaces are declared with excessively long names.

Example

class ATooLongClassNameThatHintsAtADesignProblem {

}

interface ATooLongInterfaceNameThatHintsAtADesignProblem {

}

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

Avoid excessively long class names like ThreemaGateway_Installer_TfaPendingConfirmMsgs. Keep class name length under 40.
Open

class ThreemaGateway_Installer_TfaPendingConfirmMsgs
{
    /**
     * @var string database table name
     */

LongClassName

Since: 2.9

Detects when classes or interfaces are declared with excessively long names.

Example

class ATooLongClassNameThatHintsAtADesignProblem {

}

interface ATooLongInterfaceNameThatHintsAtADesignProblem {

}

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

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