MPOS/php-mpos

View on GitHub

Showing 1,089 of 1,089 total issues

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

<?php
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;

class Share Extends Base {
  protected $table = 'shares';
Severity: Minor
Found in include/classes/share.class.php - About 2 hrs to fix

    Method smarty_modifier_debug_print_var has 70 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function smarty_modifier_debug_print_var ($var, $depth = 0, $length = 40)
    {
        $_replace = array("\n" => '<i>\n</i>',
            "\r" => '<i>\r</i>',
            "\t" => '<i>\t</i>'
    Severity: Major
    Found in include/smarty/libs/plugins/modifier.debug_print_var.php - About 2 hrs to fix

      Method compile has 70 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        File function.html_select_date.php has 283 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
         * Smarty plugin
         *
         * @package Smarty
        Severity: Minor
        Found in include/smarty/libs/plugins/function.html_select_date.php - About 2 hrs to fix

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

                      if ($_double_encode) {
                          // php >=5.3.2 - go native
                          return htmlspecialchars($string, ENT_QUOTES, $char_set, $double_encode);
                      } else {
                          if ($double_encode) {
          Severity: Major
          Found in include/smarty/libs/plugins/modifier.escape.php and 1 other location - About 2 hrs to fix
          include/smarty/libs/plugins/modifier.escape.php on lines 79..91

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

          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 ($_double_encode) {
                          return htmlentities($string, ENT_QUOTES, $char_set, $double_encode);
                      } else {
                          if ($double_encode) {
                              return htmlentities($string, ENT_QUOTES, $char_set);
          Severity: Major
          Found in include/smarty/libs/plugins/modifier.escape.php and 1 other location - About 2 hrs to fix
          include/smarty/libs/plugins/modifier.escape.php on lines 37..52

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

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

              public function compile($args, $compiler, $parameter)
              {
                  $_index = preg_split("/\]\[/",substr($parameter, 1, strlen($parameter)-2));
                  $compiled_ref = ' ';
                  $variable = trim($_index[0], "'");

            Function smarty_function_cycle has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

            function smarty_function_cycle($params, $template)
            {
                static $cycle_vars;
            
                $name = (empty($params['name'])) ? 'default' : $params['name'];
            Severity: Minor
            Found in include/smarty/libs/plugins/function.cycle.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 smarty_block_textformat has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

            function smarty_block_textformat($params, $content, $template, &$repeat)
            {
                if (is_null($content)) {
                    return;
                }
            Severity: Minor
            Found in include/smarty/libs/plugins/block.textformat.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 smarty_modifier_capitalize has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

            function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = false)
            {
                if (Smarty::$_MBSTRING) {
                    if ($lc_rest) {
                        // uppercase (including hyphenated words)
            Severity: Minor
            Found in include/smarty/libs/plugins/modifier.capitalize.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 compile has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

                public function compile($args, $compiler)
                {
                    // check and get attributes
                    $_attr = $this->getAttributes($compiler, $args);
            
            
            Severity: Minor
            Found in include/smarty/libs/sysplugins/smarty_internal_compile_section.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 createTemplate has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

                public function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null, $do_clone = true)
                {
                    if (!empty($cache_id) && (is_object($cache_id) || is_array($cache_id))) {
                        $parent = $cache_id;
                        $cache_id = null;
            Severity: Minor
            Found in include/smarty/libs/Smarty.class.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 compile has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

                public function compile($args, $compiler, $parameter)
                {
                    // the following must be assigned at runtime because it will be overwritten in Smarty_Internal_Compile_Append
                    $this->required_attributes = array('var', 'value');
                    $this->shorttag_order = array('var', 'value');
            Severity: Minor
            Found in include/smarty/libs/sysplugins/smarty_internal_compile_assign.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 getNotificatorInstance has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

                    public function getNotificatorInstance($notificator, $data){
                        $class = null;
                        $file = null;
                        
                        if (is_array($notificator)){
            Severity: Minor
            Found in include/classes/pushnotification.class.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 encodeString has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

                public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
                {
                    if ($maxLineLength > 76 || $maxLineLength <= 0) {
                        $maxLineLength = 76;
                    }
            Severity: Minor
            Found in include/lib/swiftmailer/classes/Swift/Encoder/QpEncoder.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

            Method createTemplateCodeFrame has 68 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function createTemplateCodeFrame($content = '', $cache = false)
                {
                    $plugins_string = '';
                    // include code for plugins
                    if (!$cache) {
            Severity: Major
            Found in include/smarty/libs/sysplugins/smarty_internal_template.php - About 2 hrs to fix

              Method compile has 67 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function compile($args, $compiler)
                  {
                      // check and get attributes
                      $_attr = $this->getAttributes($compiler, $args);
                      // save possible attributes
              Severity: Major
              Found in include/smarty/libs/sysplugins/smarty_internal_compile_call.php - About 2 hrs to fix

                Method getTransactions has 67 lines of code (exceeds 25 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: Major
                Found in include/classes/transaction.class.php - About 2 hrs to fix

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

                          if ($parent_scope == Smarty::SCOPE_LOCAL) {
                              $tpl->tpl_vars = $this->tpl_vars;
                              $tpl->tpl_vars['smarty'] = clone $this->tpl_vars['smarty'];
                          } elseif ($parent_scope == Smarty::SCOPE_PARENT) {
                              $tpl->tpl_vars = &$this->tpl_vars;
                  Severity: Major
                  Found in include/smarty/libs/sysplugins/smarty_internal_template.php and 1 other location - About 2 hrs to fix
                  include/smarty/libs/sysplugins/smarty_internal_template.php on lines 305..316

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

                  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 ($parent_scope == Smarty::SCOPE_LOCAL) {
                              $tpl->tpl_vars = $this->tpl_vars;
                              $tpl->tpl_vars['smarty'] = clone $this->tpl_vars['smarty'];
                          } elseif ($parent_scope == Smarty::SCOPE_PARENT) {
                              $tpl->tpl_vars = &$this->tpl_vars;
                  Severity: Major
                  Found in include/smarty/libs/sysplugins/smarty_internal_template.php and 1 other location - About 2 hrs to fix
                  include/smarty/libs/sysplugins/smarty_internal_template.php on lines 264..275

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

                  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