MPOS/php-mpos

View on GitHub

Showing 1,089 of 1,089 total issues

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

class TP_yyToken implements ArrayAccess
{
    public $string = '';
    public $metadata = array();

include/smarty/libs/sysplugins/smarty_internal_configfileparser.php on lines 12..75

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 338.

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

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

    public function compile($args, $compiler, $parameter)
    {
        // check and get attributes
        $_attr = $this->getAttributes($compiler, $args);
        // nocache option

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_utility.php has 668 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Project:     Smarty: the PHP compiling template engine
 * File:        smarty_internal_utility.php
 * SVN:         $Id: $
Severity: Major
Found in include/smarty/libs/sysplugins/smarty_internal_utility.php - About 1 day to fix

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

        if ($bitcoin->validateaddress($aUserData['coin_address'])) {
          if (!$transaction_id = $transaction->createDebitMPRecord($aUserData['id'], $aUserData['coin_address'], $aUserData['confirmed'])) {
            $log->logFatal('    failed to fullt debit user ' . $aUserData['username'] . ': ' . $transaction->getCronError());
            $monitoring->endCronjob($cron_name, 'E0064', 1, true);
          } else if (!$config['sendmany']['enabled'] || !$sendmanyAvailable) {
    Severity: Major
    Found in cronjobs/payouts.php and 1 other location - About 1 day to fix
    cronjobs/payouts.php on lines 170..195

    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 328.

    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

        if ($bitcoin->validateaddress($aUserData['coin_address'])) {
          if (!$transaction_id = $transaction->createDebitAPRecord($aUserData['id'], $aUserData['coin_address'], $aUserData['confirmed'])) {
            $log->logFatal('    failed to fully debit user ' . $aUserData['username'] . ': ' . $transaction->getCronError());
            $monitoring->endCronjob($cron_name, 'E0064', 1, true);
          } else if (!$config['sendmany']['enabled'] || !$sendmanyAvailable) {
    Severity: Major
    Found in cronjobs/payouts.php and 1 other location - About 1 day to fix
    cronjobs/payouts.php on lines 87..112

    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 328.

    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

    File Smarty.class.php has 656 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * Project:     Smarty: the PHP compiling template engine
     * File:        Smarty.class.php
     * SVN:         $Id: Smarty.class.php 4800 2013-12-15 15:19:01Z Uwe.Tews@googlemail.com $
    Severity: Major
    Found in include/smarty/libs/Smarty.class.php - About 1 day to fix

      Method fetch has 282 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null, $display = false, $merge_tpl_vars = true, $no_output_filter = false)
          {
              if ($template === null && $this instanceof $this->template_class) {
                  $template = $this;
              }
      Severity: Major
      Found in include/smarty/libs/sysplugins/smarty_internal_templatebase.php - About 1 day to fix

        Method smarty_function_html_select_time has 279 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function smarty_function_html_select_time($params, $template)
        {
            $prefix = "Time_";
            $field_array = null;
            $field_separator = "\n";
        Severity: Major
        Found in include/smarty/libs/plugins/function.html_select_time.php - About 1 day to fix

          Method smarty_function_html_select_date has 277 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function smarty_function_html_select_date($params, $template)
          {
              // generate timestamps used for month names only
              static $_month_timestamps = null;
              static $_current_year = null;
          Severity: Major
          Found in include/smarty/libs/plugins/function.html_select_date.php - About 1 day to fix

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

            <?php
            /**
             * Smarty Internal Plugin Compile Break
             *
             * Compiles the {break} tag
            include/smarty/libs/sysplugins/smarty_internal_compile_continue.php on lines 1..76

            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 308.

            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
            /**
             * Smarty Internal Plugin Compile Continue
             *
             * Compiles the {continue} tag
            include/smarty/libs/sysplugins/smarty_internal_compile_break.php on lines 1..75

            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 308.

            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

            Function _hashHTMLBlocks_inMarkdown has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function _hashHTMLBlocks_inMarkdown($text, $indent = 0,
                                                    $enclosing_tag_re = '', $span = false)
                {
                #
                # Parse markdown text, calling _HashHTMLBlocks_InHTML for block tags.
            Severity: Minor
            Found in include/lib/Michelf/Markdown.php - About 1 day 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 yy_shift($yyNewState, $yyMajor, $yypMinor)
                {
                    $this->yyidx++;
                    if ($this->yyidx >= self::YYSTACKDEPTH) {
                        $this->yyidx--;
            include/smarty/libs/sysplugins/smarty_internal_templateparser.php on lines 1696..1730

            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 291.

            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 yy_shift($yyNewState, $yyMajor, $yypMinor)
                {
                    $this->yyidx++;
                    if ($this->yyidx >= self::YYSTACKDEPTH) {
                        $this->yyidx--;
            include/smarty/libs/sysplugins/smarty_internal_configfileparser.php on lines 590..624

            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 291.

            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

               public function yy_find_shift_action($iLookAhead)
                {
                    $stateno = $this->yystack[$this->yyidx]->stateno;
            
                    /* if ($this->yyidx < 0) return self::YY_NO_ACTION;  */
            include/smarty/libs/sysplugins/smarty_internal_templateparser.php on lines 1637..1671

            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 287.

            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

               public function yy_find_shift_action($iLookAhead)
                {
                    $stateno = $this->yystack[$this->yyidx]->stateno;
            
                    /* if ($this->yyidx < 0) return self::YY_NO_ACTION;  */
            include/smarty/libs/sysplugins/smarty_internal_configfileparser.php on lines 531..565

            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 287.

            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

                    if (!$_compile_dir) {
                        $status = false;
                        $message = "FAILED: {$__compile_dir} does not exist";
                        if ($errors === null) {
                            echo $message . ".\n";
            Severity: Major
            Found in include/smarty/libs/sysplugins/smarty_internal_utility.php and 1 other location - About 1 day to fix
            include/smarty/libs/sysplugins/smarty_internal_utility.php on lines 514..550

            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 283.

            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

                    if (!$_cache_dir) {
                        $status = false;
                        $message = "FAILED: {$__cache_dir} does not exist";
                        if ($errors === null) {
                            echo $message . ".\n";
            Severity: Major
            Found in include/smarty/libs/sysplugins/smarty_internal_utility.php and 1 other location - About 1 day to fix
            include/smarty/libs/sysplugins/smarty_internal_utility.php on lines 381..417

            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 283.

            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

            Function MetisMenu has 244 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              var MetisMenu = function ($) {
            
                var NAME = 'metisMenu';
                var DATA_KEY = 'metisMenu';
                var EVENT_KEY = '.' + DATA_KEY;
            Severity: Major
            Found in public/site_assets/bootstrap/js/plugins/metisMenu/jquery.metisMenu.js - About 1 day to fix

              Function buildFilepath has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function buildFilepath(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)
                  {
                      $file = $source->name;
                      if ($source instanceof Smarty_Config_Source) {
                          $_directories = $source->smarty->getConfigDir();
              Severity: Minor
              Found in include/smarty/libs/sysplugins/smarty_resource.php - About 1 day 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