rugk/xenforo-threema-gateway

View on GitHub
src/library/ThreemaGateway/Tfa/AbstractProvider.php

Summary

Maintainability
D
1 day
Test Coverage

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

    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

      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_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.
           *

      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

        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

        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 renderVerification has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function renderVerification(XenForo_View $view, $context, array $user,
                                                array $providerData, array $triggerData)
        Severity: Minor
        Found in src/library/ThreemaGateway/Tfa/AbstractProvider.php - About 35 mins to fix

          Avoid too many return statements within this method.
          Open

                          return null;
          Severity: Major
          Found in src/library/ThreemaGateway/Tfa/AbstractProvider.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return $controller->responseView(
                        'ThreemaGateway_ViewPublic_TfaManage',
                        'account_two_step_' . $this->_providerId . '_manage',
                        $viewParams
                    );
            Severity: Major
            Found in src/library/ThreemaGateway/Tfa/AbstractProvider.php - About 30 mins to fix

              Function parseTime has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  final protected function parseTime($seconds)
                  {
                      /** @var string $displayTime output/result */
                      $displayTime = '';
                      /** @var int $minutes */
              Severity: Minor
              Found in src/library/ThreemaGateway/Tfa/AbstractProvider.php - About 25 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

              The method handleManage() has 146 lines of code. Current threshold is set to 100. Avoid really long methods.
              Open

                  final public function handleManage(XenForo_Controller $controller, array $user, array $providerData)
                  {
                      $this->gatewayPermissions->setUserId($user);
              
                      /** @var XenForo_Input $input */

              The method handleManage() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
              Open

                  final public function handleManage(XenForo_Controller $controller, array $user, array $providerData)
                  {
                      $this->gatewayPermissions->setUserId($user);
              
                      /** @var XenForo_Input $input */

              CyclomaticComplexity

              Since: 0.1

              Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

              Example

              // Cyclomatic Complexity = 11
              class Foo {
              1   public function example() {
              2       if ($a == $b) {
              3           if ($a1 == $b1) {
                              fiddle();
              4           } elseif ($a2 == $b2) {
                              fiddle();
                          } else {
                              fiddle();
                          }
              5       } elseif ($c == $d) {
              6           while ($c == $d) {
                              fiddle();
                          }
              7        } elseif ($e == $f) {
              8           for ($n = 0; $n < $h; $n++) {
                              fiddle();
                          }
                      } else {
                          switch ($z) {
              9               case 1:
                                  fiddle();
                                  break;
              10              case 2:
                                  fiddle();
                                  break;
              11              case 3:
                                  fiddle();
                                  break;
                              default:
                                  fiddle();
                                  break;
                          }
                      }
                  }
              }

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

              The method getDefaultThreemaId() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
              Open

                  final protected function getDefaultThreemaId(array $user)
                  {
                      /** @var XenForo_Options $options */
                      $options = XenForo_Application::getOptions();
                      // check for custom user field

              CyclomaticComplexity

              Since: 0.1

              Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

              Example

              // Cyclomatic Complexity = 11
              class Foo {
              1   public function example() {
              2       if ($a == $b) {
              3           if ($a1 == $b1) {
                              fiddle();
              4           } elseif ($a2 == $b2) {
                              fiddle();
                          } else {
                              fiddle();
                          }
              5       } elseif ($c == $d) {
              6           while ($c == $d) {
                              fiddle();
                          }
              7        } elseif ($e == $f) {
              8           for ($n = 0; $n < $h; $n++) {
                              fiddle();
                          }
                      } else {
                          switch ($z) {
              9               case 1:
                                  fiddle();
                                  break;
              10              case 2:
                                  fiddle();
                                  break;
              11              case 3:
                                  fiddle();
                                  break;
                              default:
                                  fiddle();
                                  break;
                          }
                      }
                  }
              }

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

              The class ThreemaGateway_Tfa_AbstractProvider has a coupling between objects value of 19. Consider to reduce the number of dependencies under 13.
              Open

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

              CouplingBetweenObjects

              Since: 1.1.0

              A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

              Example

              class Foo {
                  /**
                   * @var \foo\bar\X
                   */
                  private $x = null;
              
                  /**
                   * @var \foo\bar\Y
                   */
                  private $y = null;
              
                  /**
                   * @var \foo\bar\Z
                   */
                  private $z = null;
              
                  public function setFoo(\Foo $foo) {}
                  public function setBar(\Bar $bar) {}
                  public function setBaz(\Baz $baz) {}
              
                  /**
                   * @return \SplObjectStorage
                   * @throws \OutOfRangeException
                   * @throws \InvalidArgumentException
                   * @throws \ErrorException
                   */
                  public function process(\Iterator $it) {}
              
                  // ...
              }

              Source https://phpmd.org/rules/design.html#couplingbetweenobjects

              Missing class import via use statement (line '73', column '20').
              Open

                      return new XenForo_Phrase('tfa_' . $this->_providerId);

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              Missing class import via use statement (line '715', column '32').
              Open

                          $displayTime = new XenForo_Phrase('threemagw_one_day');

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              Missing class import via use statement (line '717', column '59').
              Open

                          $displayTime = floor($hours / 24) . ' ' . new XenForo_Phrase('threemagw_days');

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              Missing class import via use statement (line '707', column '49').
              Open

                          $displayTime = $minutes . ' ' . new XenForo_Phrase('threemagw_minutes');

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              Missing class import via use statement (line '64', column '41').
              Open

                      $this->gatewayServer      = new ThreemaGateway_Handler_Action_GatewayServer;

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              Missing class import via use statement (line '65', column '41').
              Open

                      $this->gatewaySender      = new ThreemaGateway_Handler_Action_Sender;

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              Missing class import via use statement (line '339', column '27').
              Open

                              throw new XenForo_Exception('Request invalid.');

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              Missing class import via use statement (line '112', column '45').
              Open

                          throw new XenForo_Exception(new XenForo_Phrase('threemagw_this_tfa_mode_is_not_setup'));

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              Missing class import via use statement (line '112', column '23').
              Open

                          throw new XenForo_Exception(new XenForo_Phrase('threemagw_this_tfa_mode_is_not_setup'));

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              Missing class import via use statement (line '710', column '32').
              Open

                          $displayTime = new XenForo_Phrase('threemagw_one_hour');

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              Missing class import via use statement (line '712', column '47').
              Open

                          $displayTime = $hours . ' ' . new XenForo_Phrase('threemagw_hours');

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              Missing class import via use statement (line '63', column '41').
              Open

                      $this->gatewaySettings    = new ThreemaGateway_Handler_Settings;

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              Missing class import via use statement (line '319', column '59').
              Open

                                  return $controller->responseError(new XenForo_Phrase('two_step_verification_value_could_not_be_confirmed'));

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              Missing class import via use statement (line '81', column '20').
              Open

                      return new XenForo_Phrase('tfa_' . $this->_providerId . '_desc');

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              Missing class import via use statement (line '705', column '32').
              Open

                          $displayTime = new XenForo_Phrase('threemagw_one_minute');

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              Avoid using static access to class 'ThreemaGateway_Helper_Random' in method 'generateRandomSecret'.
              Open

                          $secret = ThreemaGateway_Helper_Random::getRandomNumeric($length);

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class 'XenForo_Model' in method 'saveProviderOptions'.
              Open

                      $tfaModel = XenForo_Model::create('XenForo_Model_Tfa');

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class 'ThreemaGateway_Helper_Random' in method 'generateRandomSecret'.
              Open

                          $random = ThreemaGateway_Helper_Random::getRandomBytes(4);

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class 'XenForo_DataWriter' in method 'registerPendingConfirmationMessage'.
              Open

                      $model = XenForo_DataWriter::create('ThreemaGateway_Model_TfaPendingMessagesConfirmation');

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class 'ThreemaGateway_Handler_Validation' in method 'verifySetupFromInput'.
              Open

                      if (!ThreemaGateway_Handler_Validation::checkThreemaId($threemaid, 'personal', $verifyError)) {

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class 'XenForo_Application' in method 'handleManage'.
              Open

                      $session = XenForo_Application::getSession();

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class 'ThreemaGateway_Helper_Emoji' in method 'sendMessage'.
              Open

                      $messageText = ThreemaGateway_Helper_Emoji::parseUnicode($messageText);

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class 'XenForo_Application' in method 'getDefaultThreemaId'.
              Open

                      $options = XenForo_Application::getOptions();

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              The method handleManage uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
              Open

                      } else {
                          //first manage page ($context = setup)
                          $threemaId = $providerData['threemaid'];
                      }

              ElseExpression

              Since: 1.4.0

              An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

              Example

              class Foo
              {
                  public function bar($flag)
                  {
                      if ($flag) {
                          // one branch
                      } else {
                          // another branch
                      }
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#elseexpression

              Avoid using static access to class 'ThreemaGateway_Handler_PhpSdk' in method 'getSdk'.
              Open

                          $this->gatewaySdk = ThreemaGateway_Handler_PhpSdk::getInstance($this->gatewaySettings);

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class 'ThreemaGateway_Handler_Permissions' in method '__construct'.
              Open

                      $this->gatewayPermissions = ThreemaGateway_Handler_Permissions::getInstance();

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              The method handleManage uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
              Open

                          } else {
                              throw new XenForo_Exception('Request invalid.');
                          }

              ElseExpression

              Since: 1.4.0

              An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

              Example

              class Foo
              {
                  public function bar($flag)
                  {
                      if ($flag) {
                          // one branch
                      } else {
                          // another branch
                      }
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#elseexpression

              Avoid using static access to class 'XenForo_DataWriter' in method 'unregisterPendingConfirmationMessage'.
              Open

                      $dataWriter = XenForo_DataWriter::create('ThreemaGateway_DataWriter_TfaPendingMessagesConfirmation');

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              The method parseTime uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
              Open

                      } else {
                          $displayTime = floor($hours / 24) . ' ' . new XenForo_Phrase('threemagw_days');
                      }

              ElseExpression

              Since: 1.4.0

              An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

              Example

              class Foo
              {
                  public function bar($flag)
                  {
                      if ($flag) {
                          // one branch
                      } else {
                          // another branch
                      }
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#elseexpression

              Avoid using static access to class 'XenForo_DataWriter' in method 'registerPendingConfirmationMessage'.
              Open

                      $dataWriter = XenForo_DataWriter::create('ThreemaGateway_DataWriter_TfaPendingMessagesConfirmation');

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid unused parameters such as '$input'.
              Open

                  public function verifyFromInput($context, XenForo_Input $input, array $user, array &$providerData)

              UnusedFormalParameter

              Since: 0.2

              Avoid passing parameters to methods or constructors and then not using those parameters.

              Example

              class Foo
              {
                  private function bar($howdy)
                  {
                      // $howdy is not used
                  }
              }

              Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

              Avoid unused parameters such as '$view'.
              Open

                  public function renderSetup(XenForo_View $view, array $user)

              UnusedFormalParameter

              Since: 0.2

              Avoid passing parameters to methods or constructors and then not using those parameters.

              Example

              class Foo
              {
                  private function bar($howdy)
                  {
                      // $howdy is not used
                  }
              }

              Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

              Avoid unused parameters such as '$context'.
              Open

                  public function triggerVerification($context, array $user, $userIp, array &$providerData)

              UnusedFormalParameter

              Since: 0.2

              Avoid passing parameters to methods or constructors and then not using those parameters.

              Example

              class Foo
              {
                  private function bar($howdy)
                  {
                      // $howdy is not used
                  }
              }

              Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

              Avoid unused parameters such as '$context'.
              Open

                  protected function resetProviderOptionsForTrigger($context, array &$providerData)

              UnusedFormalParameter

              Since: 0.2

              Avoid passing parameters to methods or constructors and then not using those parameters.

              Example

              class Foo
              {
                  private function bar($howdy)
                  {
                      // $howdy is not used
                  }
              }

              Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

              Avoid unused parameters such as '$user'.
              Open

                  public function renderSetup(XenForo_View $view, array $user)

              UnusedFormalParameter

              Since: 0.2

              Avoid passing parameters to methods or constructors and then not using those parameters.

              Example

              class Foo
              {
                  private function bar($howdy)
                  {
                      // $howdy is not used
                  }
              }

              Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

              Avoid unused parameters such as '$userIp'.
              Open

                  public function triggerVerification($context, array $user, $userIp, array &$providerData)

              UnusedFormalParameter

              Since: 0.2

              Avoid passing parameters to methods or constructors and then not using those parameters.

              Example

              class Foo
              {
                  private function bar($howdy)
                  {
                      // $howdy is not used
                  }
              }

              Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

              Avoid unused parameters such as '$user'.
              Open

                  public function meetsRequirements(array $user, &$error)

              UnusedFormalParameter

              Since: 0.2

              Avoid passing parameters to methods or constructors and then not using those parameters.

              Example

              class Foo
              {
                  private function bar($howdy)
                  {
                      // $howdy is not used
                  }
              }

              Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

              Avoid unused parameters such as '$context'.
              Open

                  public function verifyFromInput($context, XenForo_Input $input, array $user, array &$providerData)

              UnusedFormalParameter

              Since: 0.2

              Avoid passing parameters to methods or constructors and then not using those parameters.

              Example

              class Foo
              {
                  private function bar($howdy)
                  {
                      // $howdy is not used
                  }
              }

              Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

              Avoid unused parameters such as '$view'.
              Open

                  public function renderVerification(XenForo_View $view, $context, array $user,

              UnusedFormalParameter

              Since: 0.2

              Avoid passing parameters to methods or constructors and then not using those parameters.

              Example

              class Foo
              {
                  private function bar($howdy)
                  {
                      // $howdy is not used
                  }
              }

              Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

              Avoid unused parameters such as '$providerData'.
              Open

                  public function verifyFromInput($context, XenForo_Input $input, array $user, array &$providerData)

              UnusedFormalParameter

              Since: 0.2

              Avoid passing parameters to methods or constructors and then not using those parameters.

              Example

              class Foo
              {
                  private function bar($howdy)
                  {
                      // $howdy is not used
                  }
              }

              Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

              Avoid unused parameters such as '$error'.
              Open

                  public function meetsRequirements(array $user, &$error)

              UnusedFormalParameter

              Since: 0.2

              Avoid passing parameters to methods or constructors and then not using those parameters.

              Example

              class Foo
              {
                  private function bar($howdy)
                  {
                      // $howdy is not used
                  }
              }

              Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

              Avoid unused parameters such as '$providerData'.
              Open

                                                      array $providerData, array $triggerData)

              UnusedFormalParameter

              Since: 0.2

              Avoid passing parameters to methods or constructors and then not using those parameters.

              Example

              class Foo
              {
                  private function bar($howdy)
                  {
                      // $howdy is not used
                  }
              }

              Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

              Avoid unused parameters such as '$triggerData'.
              Open

                                                      array $providerData, array $triggerData)

              UnusedFormalParameter

              Since: 0.2

              Avoid passing parameters to methods or constructors and then not using those parameters.

              Example

              class Foo
              {
                  private function bar($howdy)
                  {
                      // $howdy is not used
                  }
              }

              Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

              Avoid unused parameters such as '$context'.
              Open

                  public function renderVerification(XenForo_View $view, $context, array $user,

              UnusedFormalParameter

              Since: 0.2

              Avoid passing parameters to methods or constructors and then not using those parameters.

              Example

              class Foo
              {
                  private function bar($howdy)
                  {
                      // $howdy is not used
                  }
              }

              Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

              There are no issues that match your filters.

              Category
              Status