MPOS/php-mpos

View on GitHub

Showing 889 of 1,089 total issues

Function getWorkers has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  public function getWorkers($account_id, $interval=600) {
    $this->debug->append("STA " . __METHOD__, 4);
    $stmt = $this->mysqli->prepare("
      SELECT id, username, password, monitor,
        (
Severity: Minor
Found in include/classes/worker.class.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

Function getAllWorkers has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  public function getAllWorkers($iLimit=0, $interval=600, $start=0) {
    $this->debug->append("STA " . __METHOD__, 4);
    $stmt = $this->mysqli->prepare("
      SELECT id, username, password, monitor,
        (
Severity: Minor
Found in include/classes/worker.class.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

Function sendChangeConfigEmail has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  public function sendChangeConfigEmail($strType, $userID) {
    $exists = $this->token->doesTokenExist($strType, $userID);
    if ($exists == 0) {
      $token = $this->token->createToken($strType, $userID);
      $aData['token'] = $token;
Severity: Minor
Found in include/classes/user.class.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

Avoid deeply nested control flow statements.
Open

              if (empty($filter['type']) || ($filter['type'] != 'Debit_AP' && $filter['type'] != 'Debit_MP' && $filter['type'] != 'TXFee' && $filter['type'] != 'Credit_PPS' && $filter['type'] != 'Fee_PPS' && $filter['type'] != 'Donation_PPS')) {
                $aFilter[] = "( b.confirmations >= " . $this->config['confirmations'] . " OR ISNULL(b.confirmations) )";
              }
Severity: Major
Found in include/classes/transaction.class.php - About 45 mins to fix

    Function setupInlineSubTemplate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function setupInlineSubTemplate($template, $cache_id, $compile_id, $caching, $cache_lifetime, $data, $parent_scope, $hash)
        {
            $tpl = new $this->smarty->template_class($template, $this->smarty, $this, $cache_id, $compile_id, $caching, $cache_lifetime);
            $tpl->properties['nocache_hash']  = $hash;
            // get variables from calling scope
    Severity: Minor
    Found in include/smarty/libs/sysplugins/smarty_internal_template.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

    Function createDebitRecord has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      private function createDebitRecord($account_id, $coin_address, $amount, $type) {
        // Calculate and deduct txfee from amount
        $type == 'Debit_MP' ? $txfee = $this->config['txfee_manual'] : $txfee = $this->config['txfee_auto'];
        $amount = $amount - $txfee;
        // Add Debit record
    Severity: Minor
    Found in include/classes/transaction.class.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

    Function generatePin has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      public function generatePin($userID, $current) {
        $this->debug->append("STA " . __METHOD__, 4);
        $username = $this->getUserName($userID);
        $email = $this->getUserEmail($username);
        $strPasswordHash = $this->getUserPasswordHashById($userID);
    Severity: Minor
    Found in include/classes/user.class.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($scheme, $username, $password, $address = "localhost", $certificate_path = '', $debug = false) {
    Severity: Minor
    Found in include/classes/bitcoin.class.php - About 45 mins to fix

      Function getTemplateUid has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function getTemplateUid(Smarty $smarty, $resource_name, $cache_id, $compile_id)
          {
              $uid = '';
              if (isset($resource_name)) {
                  $tpl = new $smarty->template_class($resource_name, $smarty);
      Severity: Minor
      Found in include/smarty/libs/sysplugins/smarty_cacheresource_keyvaluestore.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 addTransaction has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        public function addTransaction($account_id, $amount, $type='Credit', $block_id=NULL, $coin_address=NULL, $txid=NULL) {
      Severity: Minor
      Found in include/classes/transaction.class.php - About 45 mins to fix

        Method buildSeed has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          private function buildSeed($data, $year, $month, $day, $hour, $minute) {
        Severity: Minor
        Found in include/classes/csrftoken.class.php - About 45 mins to fix

          Function checkBasic has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            public function checkBasic($user, $type, $token) {
              if (empty($token)) return false;
              $token_now = $this->getBasic($user, $type);
              if ($token_now !== $token) {
                $tokens_check = $this->checkAdditional($user, $type);
          Severity: Minor
          Found in include/classes/csrftoken.class.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 calc has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public static function calc($password, $salt, $n, $r, $p, $length)
          Severity: Minor
          Found in include/lib/scrypt.php - About 45 mins to fix

            Function calc has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function calc($password, $salt, $n, $r, $p, $length)
                {
                    if ($n == 0 || ($n & ($n - 1)) != 0) {
                        throw new Exception\InvalidArgumentException("N must be > 0 and a power of 2");
                    }
            Severity: Minor
            Found in include/lib/scrypt.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

            Function getEncodableWordTokens has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function getEncodableWordTokens($string)
                {
                    $tokens = array();
            
                    $encodedToken = '';
            Severity: Minor
            Found in include/lib/swiftmailer/classes/Swift/Mime/Headers/AbstractHeader.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

            Function _safeWordwrap has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                private function _safeWordwrap($string, $length = 75, $le = "\r\n")
                {
                    if (0 >= $length) {
                        return $string;
                    }

            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 toString has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function toString()
                {
                    $string = '';
                    $headers = $this->_headers;
                    if ($this->_canSort()) {
            Severity: Minor
            Found in include/lib/swiftmailer/classes/Swift/Mime/SimpleHeaderSet.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

            Function _appendFootnotes_callback has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function _appendFootnotes_callback($matches) {
                    $node_id = $this->fn_id_prefix . $matches[1];
                    
                    # Create footnote marker only if it has a corresponding footnote *and*
                    # the footnote hasn't been used by another marker.
            Severity: Minor
            Found in include/lib/Michelf/Markdown.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

            Function _bodyToString has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function _bodyToString()
                {
                    $string = '';
            
                    if (isset($this->_body) && empty($this->_immediateChildren)) {
            Severity: Minor
            Found in include/lib/swiftmailer/classes/Swift/Mime/SimpleMimeEntity.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

            Function getString has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function getString($nsKey, $itemKey)
                {
                    $this->_prepareCache($nsKey);
                    if ($this->hasKey($nsKey, $itemKey)) {
                        $fp = $this->_getHandle($nsKey, $itemKey, self::POSITION_START);
            Severity: Minor
            Found in include/lib/swiftmailer/classes/Swift/KeyCache/DiskKeyCache.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

            Severity
            Category
            Status
            Source
            Language