MPOS/php-mpos

View on GitHub

Showing 889 of 1,089 total issues

Function getTransactions has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

  public function getTransactions($start=0, $filter=NULL, $limit=30, $account_id=NULL) {
    $this->debug->append("STA " . __METHOD__, 4);
    $sql = "
      SELECT
        t.id AS id,
Severity: Minor
Found in include/classes/transaction.class.php - About 3 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 getTopContributors has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

  public function getTopContributors($type='shares', $limit=15) {
    $this->debug->append("STA " . __METHOD__, 4);
    switch ($type) {
    case 'shares':
      if ($this->getGetCache() && $data = $this->memcache->get(__FUNCTION__ . $type . $limit)) return $data;
Severity: Minor
Found in include/classes/statistics.class.php - About 3 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 filter has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public function filter($buffer, $_minReplaces = -1)
    {
        if ($this->_treeMaxLen == 0) {
            return $buffer;
        }

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 smarty_function_html_radios has 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function smarty_function_html_radios($params, $template)
{
    require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');

    $name = 'radio';
Severity: Major
Found in include/smarty/libs/plugins/function.html_radios.php - About 3 hrs to fix

    Swift_Signers_DKIMSigner has 29 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
    {
        /**
         * PrivateKey
         *
    Severity: Minor
    Found in include/lib/swiftmailer/classes/Swift/Signers/DKIMSigner.php - About 3 hrs to fix

      Swift_Transport_Esmtp_Auth_NTLMAuthenticator has 29 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Esmtp_Authenticator
      {
          const NTLMSIG = "NTLMSSP\x00";
          const DESCONST = "KGS!@#$%";
      
      

        Function smarty_function_math has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

        function smarty_function_math($params, $template)
        {
            static $_allowed_funcs = array(
                'int' => true, 'abs' => true, 'ceil' => true, 'cos' => true, 'exp' => true, 'floor' => true,
                'log' => true, 'log10' => true, 'max' => true, 'min' => true, 'pi' => true, 'pow' => true,
        Severity: Minor
        Found in include/smarty/libs/plugins/function.math.php - About 3 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 checkLogin has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

          public function checkLogin($username, $password) {
            $this->debug->append("STA " . __METHOD__, 4);
            $this->debug->append("Checking login for $username with password $password", 2);
            if (empty($username) || empty($password)) {
              $this->setErrorMessage("Invalid username or password.");
        Severity: Minor
        Found in include/classes/user.class.php - About 3 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 getCharPositions has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredChars)
            {
                if (!isset($currentMap['i']) || ! isset($currentMap['p'])) {
                    $currentMap['p'] = $currentMap['i'] = array();
                }
        Severity: Minor
        Found in include/lib/swiftmailer/classes/Swift/CharacterReader/Utf8Reader.php - About 3 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 _canonicalizeBody has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function _canonicalizeBody($string)
            {
                $len = strlen($string);
                $canon = '';
                $method = ($this->_bodyCanon == "relaxed");
        Severity: Minor
        Found in include/lib/swiftmailer/classes/Swift/Signers/DKIMSigner.php - About 3 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

        Method clear has 84 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                public function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time)
                {
                    $_cache_id = isset($cache_id) ? preg_replace('![^\w\|]+!', '_', $cache_id) : null;
                    $_compile_id = isset($compile_id) ? preg_replace('![^\w\|]+!', '_', $compile_id) : null;
                    $_dir_sep = $smarty->use_sub_dirs ? '/' : '^';
        Severity: Major
        Found in include/smarty/libs/sysplugins/smarty_internal_cacheresource_file.php - About 3 hrs to fix

          Function binl_md5 has 82 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function binl_md5(x, len) {
                  /* append padding */
                  x[len >> 5] |= 0x80 << ((len) % 32);
                  x[(((len + 64) >>> 9) << 4) + 14] = len;
          
          
          Severity: Major
          Found in public/site_assets/bootstrap/js/jquery.md5.js - About 3 hrs to fix

            Function __construct has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

              public function __construct($config, &$memcache, $request='') {
                $this->cache = $memcache;
                // set our config options
                $userORip = $_SERVER['REMOTE_ADDR'].@$_SERVER['HTTP_USER_AGENT'];
                // prep stuff we need to check this request
            Severity: Minor
            Found in include/classes/memcache_ad.class.php - About 3 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 flushQueue has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

                public function flushQueue(Swift_Transport $transport, &$failedRecipients = null)
                {
                    $directoryIterator = new DirectoryIterator($this->_path);
            
                    /* Start the transport only if there are queued files to send */
            Severity: Minor
            Found in include/lib/swiftmailer/classes/Swift/FileSpool.php - About 3 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 _bodyToByteStream has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function _bodyToByteStream(Swift_InputByteStream $is)
                {
                    if (empty($this->_immediateChildren)) {
                        if (isset($this->_body)) {
                            if ($this->_cache->hasKey($this->_cacheKey, 'body')) {
            Severity: Minor
            Found in include/lib/swiftmailer/classes/Swift/Mime/SimpleMimeEntity.php - About 3 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

            File smarty_internal_data.php has 302 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            /**
             * Smarty Internal Plugin Data
             *
             * This file contains the basic classes and methodes for template and variable creation
            Severity: Minor
            Found in include/smarty/libs/sysplugins/smarty_internal_data.php - About 3 hrs to fix

              Method doParse has 81 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function doParse($yymajor, $yytokenvalue)
                  {
                      $yyerrorhit = 0;   /* True if yymajor has invoked an error */
              
                      if ($this->yyidx === null || $this->yyidx < 0) {
              Severity: Major
              Found in include/smarty/libs/sysplugins/smarty_internal_templateparser.php - About 3 hrs to fix

                Method doParse has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function doParse($yymajor, $yytokenvalue)
                    {
                        $yyerrorhit = 0;   /* True if yymajor has invoked an error */
                
                        if ($this->yyidx === null || $this->yyidx < 0) {
                Severity: Major
                Found in include/smarty/libs/sysplugins/smarty_internal_configfileparser.php - About 3 hrs to fix

                  Method smarty_function_mailto has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function smarty_function_mailto($params, $template)
                  {
                      static $_allowed_encoding = array('javascript' => true, 'javascript_charcode' => true, 'hex' => true, 'none' => true);
                      $extra = '';
                  
                  
                  Severity: Major
                  Found in include/smarty/libs/plugins/function.mailto.php - About 3 hrs to fix

                    Method updateAccount has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      public function updateAccount($userID, $address, $threshold, $donate, $email, $timezone, $is_anonymous, $strToken) {
                        $this->debug->append("STA " . __METHOD__, 4);
                        $bUser = false;
                        $donate = round($donate, 2);
                        // number validation checks
                    Severity: Major
                    Found in include/classes/user.class.php - About 3 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language