MPOS/php-mpos

View on GitHub

Showing 1,089 of 1,089 total issues

File Mobile_Detect.php has 561 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Mobile Detect Library
 * =====================
 *
Severity: Major
Found in include/lib/Mobile_Detect.php - About 1 day to fix

    Function createTemplateCodeFrame has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
    Open

        public function createTemplateCodeFrame($content = '', $cache = false)
        {
            $plugins_string = '';
            // include code for plugins
            if (!$cache) {
    Severity: Minor
    Found in include/smarty/libs/sysplugins/smarty_internal_template.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

    File admin_settings.inc.php has 546 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
    
    $aThemes = $template->getThemes();
    $aDesigns = $template->getDesigns();
    Severity: Major
    Found in include/config/admin_settings.inc.php - About 1 day to fix

      Function doItalicsAndBold has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function doItalicsAndBold($text) {
              $token_stack = array('');
              $text_stack = array('');
              $em = '';
              $strong = '';
      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

      Function smarty_function_html_checkboxes has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
      Open

      function smarty_function_html_checkboxes($params, $template)
      {
          require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
      
          $name = 'checkbox';
      Severity: Minor
      Found in include/smarty/libs/plugins/function.html_checkboxes.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

      Function append has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
      Open

          public function append($tpl_var, $value = null, $merge = false, $nocache = false)
          {
              if (is_array($tpl_var)) {
                  // $tpl_var is an array, ignore $value
                  foreach ($tpl_var as $_key => $_val) {
      Severity: Minor
      Found in include/smarty/libs/sysplugins/smarty_internal_data.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

      File smarty_internal_configfilelexer.php has 523 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
      * Smarty Internal Plugin Configfilelexer
      *
      * This is the lexer to break the config file source into tokens 
      Severity: Major
      Found in include/smarty/libs/sysplugins/smarty_internal_configfilelexer.php - About 1 day to fix

        File smarty_internal_templatebase.php has 522 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
         * Smarty Internal Plugin Smarty Template  Base
         *
         * This file contains the basic shared methodes for template handling
        Severity: Major
        Found in include/smarty/libs/sysplugins/smarty_internal_templatebase.php - About 1 day to fix

          Function smarty_function_html_options has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
          Open

          function smarty_function_html_options($params, $template)
          {
              require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
          
              $name = null;
          Severity: Minor
          Found in include/smarty/libs/plugins/function.html_options.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

          User has 56 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class User extends Base {
            protected $table = 'accounts';
            private $userID = false;
            private $user = array();
          
          
          Severity: Major
          Found in include/classes/user.class.php - About 1 day to fix

            Function mobileGrade has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
            Open

                public function mobileGrade()
                {
                    $isMobile = $this->isMobile();
            
                    if (
            Severity: Minor
            Found in include/lib/Mobile_Detect.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

                        case 'selected':
                            if (is_array($_val)) {
                                $selected = array();
                                foreach ($_val as $_sel) {
                                    if (is_object($_sel)) {
            Severity: Major
            Found in include/smarty/libs/plugins/function.html_checkboxes.php and 1 other location - About 7 hrs to fix
            include/smarty/libs/plugins/function.html_options.php on lines 67..92

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

            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

                        case 'selected':
                            if (is_array($_val)) {
                                $selected = array();
                                foreach ($_val as $_sel) {
                                    if (is_object($_sel)) {
            Severity: Major
            Found in include/smarty/libs/plugins/function.html_options.php and 1 other location - About 7 hrs to fix
            include/smarty/libs/plugins/function.html_checkboxes.php on lines 84..109

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

            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 _hashHTMLBlocks_inMarkdown has 194 lines of code (exceeds 25 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: Major
            Found in include/lib/Michelf/Markdown.php - About 7 hrs to fix

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

                  public function __construct(Smarty_Internal_Template $_template)
                  {
                      $this->compile_id = $_template->compile_id;
                      $this->cache_id = $_template->cache_id;
                      $this->source = $_template->source;
              Severity: Minor
              Found in include/smarty/libs/sysplugins/smarty_cacheresource.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 compile has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
              Open

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

                public function updateAccount($userID, $address, $threshold, $donate, $email, $timezone, $is_anonymous, $strToken) {
                  $this->debug->append("STA " . __METHOD__, 4);
                  $bUser = false;
                  $donate = round($donate, 2);
                  // number validation checks
              Severity: Minor
              Found in include/classes/user.class.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

              Markdown has 53 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class Markdown {
              
                  ### Version ###
              
                  const  MARKDOWNLIB_VERSION  =  "1.3";
              Severity: Major
              Found in include/lib/Michelf/Markdown.php - About 7 hrs to fix

                Method compileTag has 185 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function compileTag($tag, $args, $parameter = array())
                    {
                        // $args contains the attributes parsed and compiled by the lexer/parser
                        // assume that tag does compile into code, but creates no HTML output
                        $this->has_code = true;

                  File smarty_internal_templatecompilerbase.php has 473 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  
                  /**
                   * Smarty Internal Plugin Smarty Template Compiler Base
                   *
                    Severity
                    Category
                    Status
                    Source
                    Language