MPOS/php-mpos

View on GitHub

Showing 1,089 of 1,089 total issues

Function smarty_function_html_table has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

function smarty_function_html_table($params, $template)
{
    $table_attr = 'border="1"';
    $tr_attr = '';
    $th_attr = '';
Severity: Minor
Found in include/smarty/libs/plugins/function.html_table.php - About 4 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 _hashHTMLBlocks_inHTML has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    protected function _hashHTMLBlocks_inHTML($text, $hash_method, $md_attr) {
    #
    # Parse HTML, calling _HashHTMLBlocks_InMarkdown for block tags.
    #
    # *   Calls $hash_method to convert any blocks.
Severity: Minor
Found in include/lib/Michelf/Markdown.php - About 4 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 hashHTMLBlocks has 121 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function hashHTMLBlocks($text) {
        if ($this->no_markup)  return $text;

        $less_than_tab = $this->tab_width - 1;

Severity: Major
Found in include/lib/Michelf/Markdown.php - About 4 hrs to fix

    Function compile has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

        public function compile($args, $compiler, $parameter, $tag)
        {
            if (!isset($tag[5]) || substr($tag,-5) != 'close') {
                // opening tag of block plugin
                // check and get attributes

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

        public function beforeSendPerformed(Swift_Events_SendEvent $evt)
        {
            $message = $evt->getMessage();
            $this->_restoreMessage($message);
            $to = array_keys($message->getTo());
    Severity: Minor
    Found in include/lib/swiftmailer/classes/Swift/Plugins/DecoratorPlugin.php - About 4 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 register has 118 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public function register($username, $coinaddress, $password1, $password2, $pin, $email1='', $email2='', $tac='', $strToken='') {
        $this->debug->append("STA " . __METHOD__, 4);
        if ($tac != 1) {
          $this->setErrorMessage('You need to accept our <a href="'.$_SERVER['SCRIPT_NAME'].'?page=tac" target="_blank">Terms and Conditions</a>');
          return false;
    Severity: Major
    Found in include/classes/user.class.php - About 4 hrs to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      $aRegistrationInfo = array(
        '24hours' => $user->getCountFiltered('signup_timestamp', time() - 86400, 'i', '>='),
        '7days' => $user->getCountFiltered('signup_timestamp', (time() - (86400 * 7)), 'i', '>='),
        '1month' => $user->getCountFiltered('signup_timestamp', (time() - (86400 * 7 * 4)), 'i', '>='),
        '6month' => $user->getCountFiltered('signup_timestamp', (time() - (86400 * 7 * 4 * 6)), 'i', '>='),
      Severity: Major
      Found in include/pages/admin/dashboard.inc.php and 1 other location - About 4 hrs to fix
      include/pages/admin/dashboard.inc.php on lines 53..59

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 176.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      $aLoginInfo = array(
        '24hours' => $user->getCountFiltered('last_login', time() - 86400, 'i', '>='),
        '7days' => $user->getCountFiltered('last_login', (time() - (86400 * 7)), 'i', '>='),
        '1month' => $user->getCountFiltered('last_login', (time() - (86400 * 7 * 4)), 'i', '>='),
        '6month' => $user->getCountFiltered('last_login', (time() - (86400 * 7 * 4 * 6)), 'i', '>='),
      Severity: Major
      Found in include/pages/admin/dashboard.inc.php and 1 other location - About 4 hrs to fix
      include/pages/admin/dashboard.inc.php on lines 63..69

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 176.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

        if ($config['sendmany']['enabled'] && $sendmanyAvailable && is_array($aSendMany)) {
          try {
            $rpc_txid = $bitcoin->sendmany('', $aSendMany);
          } catch (Exception $e) {
            $log->logError('E0078: RPC method sendmany did not return 200 OK: Address: ' . $aUserData['coin_address'] . ' ERROR: ' . $e->getMessage());
      Severity: Major
      Found in cronjobs/payouts.php and 1 other location - About 4 hrs to fix
      cronjobs/payouts.php on lines 197..211

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 176.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

        if ($config['sendmany']['enabled'] && $sendmanyAvailable && is_array($aSendMany)) {
          try {
            $rpc_txid = $bitcoin->sendmany('', $aSendMany);
          } catch (Exception $e) {
            $log->logError('E0078: RPC method sendmany did not return 200 OK: Address: ' . $aUserData['coin_address'] . ' ERROR: ' . $e->getMessage());
      Severity: Major
      Found in cronjobs/payouts.php and 1 other location - About 4 hrs to fix
      cronjobs/payouts.php on lines 114..128

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 176.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Method doItalicsAndBold has 115 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function doItalicsAndBold($text) {
              $token_stack = array('');
              $text_stack = array('');
              $em = '';
              $strong = '';
      Severity: Major
      Found in include/lib/Michelf/Markdown.php - About 4 hrs to fix

        Function compileTemplate has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

            public function compileTemplate(Smarty_Internal_Template $template, $nocache = false)
            {
                if (empty($template->properties['nocache_hash'])) {
                    $template->properties['nocache_hash'] = $this->nocache_hash;
                } else {

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

            public function loadConfigVars($sections = null, $scope = 'local')
            {
                if ($this->data instanceof Smarty_Internal_Template) {
                    $this->data->properties['file_dependency'][sha1($this->source->filepath)] = array($this->source->filepath, $this->source->timestamp, 'file');
                }
        Severity: Minor
        Found in include/smarty/libs/sysplugins/smarty_internal_config.php - About 4 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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        <?php
        $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
        
        // Check if the API is activated
        $api->isActive();
        Severity: Major
        Found in include/pages/api/getuserhashrate.inc.php and 1 other location - About 4 hrs to fix
        include/pages/api/getusersharerate.inc.php on lines 1..24

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 174.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        <?php
        $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
        
        // Check if the API is activated
        $api->isActive();
        Severity: Major
        Found in include/pages/api/getusersharerate.inc.php and 1 other location - About 4 hrs to fix
        include/pages/api/getuserhashrate.inc.php on lines 1..24

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 174.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        SmartyBC has 35 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class SmartyBC extends Smarty
        {
            /**
             * Smarty 2 BC
             * @var string
        Severity: Minor
        Found in include/smarty/libs/SmartyBC.class.php - About 4 hrs to fix

          Function smarty_mb_wordwrap has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

              function smarty_mb_wordwrap($str, $width=75, $break="\n", $cut=false)
              {
                  // break words into tokens using white space as a delimiter
                  $tokens = preg_split('!(\s)!S' . Smarty::$_UTF8_MODIFIER, $str, -1, PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE);
                  $length = 0;
          Severity: Minor
          Found in include/smarty/libs/plugins/shared.mb_wordwrap.php - About 4 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 getTemplateVars has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getTemplateVars($varname = null, $_ptr = null, $search_parents = true)
              {
                  if (isset($varname)) {
                      $_var = $this->getVariable($varname, $_ptr, $search_parents, false);
                      if (is_object($_var)) {
          Severity: Minor
          Found in include/smarty/libs/sysplugins/smarty_internal_data.php - About 4 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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            public function getCoinAddress($userID, $currency=NULL) {
              if ($currency === NULL) $currency = $this->config['currency'];
              $this->debug->append("STA " . __METHOD__, 4);
              $stmt = $this->mysqli->prepare("
                SELECT coin_address
          Severity: Major
          Found in include/classes/coin_address.class.php and 1 other location - About 4 hrs to fix
          include/classes/coin_address.class.php on lines 45..60

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 171.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            public function getAPThreshold($userID, $currency=NULL) {
              if ($currency === NULL) $currency = $this->config['currency'];
              $this->debug->append("STA " . __METHOD__, 4);
              $stmt = $this->mysqli->prepare("
                SELECT ap_threshold
          Severity: Major
          Found in include/classes/coin_address.class.php and 1 other location - About 4 hrs to fix
          include/classes/coin_address.class.php on lines 23..38

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 171.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Severity
          Category
          Status
          Source
          Language