MPOS/php-mpos

View on GitHub

Showing 1,089 of 1,089 total issues

File SimpleMimeEntity.php has 472 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/*
 * This file is part of SwiftMailer.
 * (c) 2004-2009 Chris Corbyn
Severity: Minor
Found in include/lib/swiftmailer/classes/Swift/Mime/SimpleMimeEntity.php - About 7 hrs to fix

    Function doParse has a Cognitive Complexity of 47 (exceeds 5 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: Minor
    Found in include/smarty/libs/sysplugins/smarty_internal_templateparser.php - About 7 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 doParse has a Cognitive Complexity of 47 (exceeds 5 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: Minor
    Found in include/smarty/libs/sysplugins/smarty_internal_configfileparser.php - About 7 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

    Swift_Mime_SimpleMimeEntity has 51 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
    {
        /** A collection of Headers for this mime entity */
        private $_headers;
    
    
    Severity: Major
    Found in include/lib/swiftmailer/classes/Swift/Mime/SimpleMimeEntity.php - About 7 hrs to fix

      Function getAttributes has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getAttributes($compiler, $attributes)
          {
              $_indexed_attr = array();
              // loop over attributes
              foreach ($attributes as $key => $mixed) {
      Severity: Minor
      Found in include/smarty/libs/sysplugins/smarty_internal_compilebase.php - About 7 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

                      if ($_key != '') {
                          if (!isset($this->tpl_vars[$_key])) {
                              $tpl_var_inst = $this->getVariable($_key, null, true, false);
                              if ($tpl_var_inst instanceof Undefined_Smarty_Variable) {
                                  $this->tpl_vars[$_key] = new Smarty_variable(null, $nocache);
      Severity: Major
      Found in include/smarty/libs/sysplugins/smarty_internal_data.php and 1 other location - About 7 hrs to fix
      include/smarty/libs/sysplugins/smarty_internal_data.php on lines 146..165

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

      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 ($tpl_var != '' && isset($value)) {
                      if (!isset($this->tpl_vars[$tpl_var])) {
                          $tpl_var_inst = $this->getVariable($tpl_var, null, true, false);
                          if ($tpl_var_inst instanceof Undefined_Smarty_Variable) {
                              $this->tpl_vars[$tpl_var] = new Smarty_variable(null, $nocache);
      Severity: Major
      Found in include/smarty/libs/sysplugins/smarty_internal_data.php and 1 other location - About 7 hrs to fix
      include/smarty/libs/sysplugins/smarty_internal_data.php on lines 124..143

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

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

          public static function clearCompiledTemplate($resource_name, $compile_id, $exp_time, Smarty $smarty)
          {
              $_compile_dir = $smarty->getCompileDir();
              $_compile_id = isset($compile_id) ? preg_replace('![^\w\|]+!', '_', $compile_id) : null;
              $_dir_sep = $smarty->use_sub_dirs ? DS : '^';
      Severity: Minor
      Found in include/smarty/libs/sysplugins/smarty_internal_utility.php - About 6 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 addConfigDir($config_dir, $key=null)
          {
              // make sure we're dealing with an array
              $this->config_dir = (array) $this->config_dir;
      
      
      Severity: Major
      Found in include/smarty/libs/Smarty.class.php and 1 other location - About 6 hrs to fix
      include/smarty/libs/Smarty.class.php on lines 854..879

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

      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 addTemplateDir($template_dir, $key=null)
          {
              // make sure we're dealing with an array
              $this->template_dir = (array) $this->template_dir;
      
      
      Severity: Major
      Found in include/smarty/libs/Smarty.class.php and 1 other location - About 6 hrs to fix
      include/smarty/libs/Smarty.class.php on lines 921..947

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

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

      function smarty_function_fetch($params, $template)
      {
          if (empty($params['file'])) {
              trigger_error("[plugin] fetch parameter 'file' cannot be empty",E_USER_NOTICE);
      
      
      Severity: Major
      Found in include/smarty/libs/plugins/function.fetch.php - About 6 hrs to fix

        Function smarty_function_html_image has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
        Open

        function smarty_function_html_image($params, $template)
        {
            require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
        
            $alt = '';
        Severity: Minor
        Found in include/smarty/libs/plugins/function.html_image.php - About 6 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 generateUpToDateMimeArray has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
        Open

        function generateUpToDateMimeArray()
        {
            $preamble = "<?php\n\n";
            $preamble .= "/*\n";
            $preamble .= " * This file is part of SwiftMailer.\n";
        Severity: Minor
        Found in include/lib/swiftmailer/swiftmailer_generate_mimes_config.php - About 6 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_function_html_radios has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
        Open

        function smarty_function_html_radios($params, $template)
        {
            require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
        
            $name = 'radio';
        Severity: Minor
        Found in include/smarty/libs/plugins/function.html_radios.php - About 6 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_escape has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
        Open

        function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $double_encode = true)
        {
            static $_double_encode = null;
            if ($_double_encode === null) {
                $_double_encode = version_compare(PHP_VERSION, '5.2.3', '>=');
        Severity: Minor
        Found in include/smarty/libs/plugins/modifier.escape.php - About 6 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 register has a Cognitive Complexity of 42 (exceeds 5 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: Minor
        Found in include/classes/user.class.php - About 6 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 42 (exceeds 5 allowed). Consider refactoring.
        Open

            public function compile($args, $compiler)
            {
                // check and get attributes
                $_attr = $this->getAttributes($compiler, $args);
                // never compile as nocache code
        Severity: Minor
        Found in include/smarty/libs/sysplugins/smarty_internal_compile_insert.php - About 6 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 41 (exceeds 5 allowed). Consider refactoring.
        Open

            public function compile($args, $compiler)
            {
                // check and get attributes
                $_attr = $this->getAttributes($compiler, $args);
                // save possible attributes
        Severity: Minor
        Found in include/smarty/libs/sysplugins/smarty_internal_compile_call.php - About 6 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 MetisMenu has 153 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            var MetisMenu = function () {
              function MetisMenu(element, config) {
                _classCallCheck(this, MetisMenu);
        
                this._element = element;
        Severity: Major
        Found in public/site_assets/bootstrap/js/plugins/metisMenu/jquery.metisMenu.js - About 6 hrs to fix

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

              public function compile($args, $compiler, $parameter)
              {
                  // check and get attributes
                  $_attr = $this->getAttributes($compiler, $args);
                  // save posible attributes
          Severity: Major
          Found in include/smarty/libs/sysplugins/smarty_internal_compile_include.php - About 6 hrs to fix
            Severity
            Category
            Status
            Source
            Language