MPOS/php-mpos

View on GitHub

Showing 1,089 of 1,089 total issues

Method write has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function write($chars)
    {
        if (!isset($this->_charReader)) {
            $this->_charReader = $this->_charReaderFactory->getReaderFor(
                $this->_charset);

    Method appendFootnotes has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function appendFootnotes($text) {
        #
        # Append footnote list to text.
        #
            $text = preg_replace_callback('{F\x1Afn:(.*?)\x1A:}', 
    Severity: Major
    Found in include/lib/Michelf/Markdown.php - About 2 hrs to fix

      Method decodeProperties has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function decodeProperties($properties, $cache = false)
          {
              $this->has_nocache_code = $properties['has_nocache_code'];
              $this->properties['nocache_hash'] = $properties['nocache_hash'];
              if (isset($properties['cache_lifetime'])) {
      Severity: Minor
      Found in include/smarty/libs/sysplugins/smarty_internal_template.php - About 2 hrs to fix

        Method isTrustedResourceDir has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function isTrustedResourceDir($filepath)
            {
                $_template = false;
                $_config = false;
                $_secure = false;
        Severity: Minor
        Found in include/smarty/libs/sysplugins/smarty_security.php - About 2 hrs to fix

          Method doTables has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function doTables($text) {
              #
              # Form HTML tables.
              #
                  $less_than_tab = $this->tab_width - 1;
          Severity: Minor
          Found in include/lib/Michelf/Markdown.php - About 2 hrs to fix

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

            if (!is_writable(TEMPLATE_DIR . '/compile')) {
              $newerror = array();
              $newerror['name'] = "templates/compile permissions";
              $newerror['level'] = 3;
              $newerror['extdesc'] = "In order to cache compiled template data, we need to be able to write in the templates/compile folder. See the link above for more details.";
            Severity: Major
            Found in include/pages/admin/checks/check_permissions.inc.php and 1 other location - About 2 hrs to fix
            include/pages/admin/checks/check_permissions.inc.php on lines 20..30

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

            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

                static public $yy_lookahead = array(
             /*     0 */     7,    8,    9,   10,   11,   12,    5,   27,   15,   16,
             /*    10 */    20,   21,   23,   23,   17,   18,   13,   14,   17,   18,
             /*    20 */    15,    2,   17,    4,   25,   26,    6,    3,    3,   14,
             /*    30 */    23,    1,   24,   17,    2,   25,   22,   25,
            include/smarty/libs/sysplugins/smarty_internal_configfileparser.php on lines 206..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 121.

            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 (!is_writable(TEMPLATE_DIR . '/cache')) {
              $newerror = array();
              $newerror['name'] = "templates/cache permissions";
              $newerror['level'] = 3;
              $newerror['extdesc'] = "In order to cache template data, we need to be able to write in the templates/cache folder. See the link above for more details.";
            Severity: Major
            Found in include/pages/admin/checks/check_permissions.inc.php and 1 other location - About 2 hrs to fix
            include/pages/admin/checks/check_permissions.inc.php on lines 31..41

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

            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

            static public $yy_action = array(
             /*     0 */    29,   30,   34,   33,   24,   13,   19,   25,   35,   21,
             /*    10 */    59,    8,    3,    1,   20,   12,   14,   31,   20,   12,
             /*    20 */    15,   17,   23,   18,   27,   26,    4,    5,    6,   32,
             /*    30 */     2,   11,   28,   22,   16,    9,    7,   10,
            include/smarty/libs/sysplugins/smarty_internal_configfileparser.php on lines 212..217

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

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

            function smarty_function_math($params, $template)
            {
                static $_allowed_funcs = array(
                    'int' => true, 'abs' => true, 'ceil' => true, 'cos' => true, 'exp' => true, 'floor' => true,
                    'log' => true, 'log10' => true, 'max' => true, 'min' => true, 'pi' => true, 'pow' => true,
            Severity: Minor
            Found in include/smarty/libs/plugins/function.math.php - About 1 hr to fix

              Method mobileGrade has 49 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function mobileGrade()
                  {
                      $isMobile = $this->isMobile();
              
                      if (
              Severity: Minor
              Found in include/lib/Mobile_Detect.php - About 1 hr to fix

                Method __construct has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function __construct($search, $replace)
                    {
                        $this->_search = $search;
                        $this->_index = array();
                        $this->_tree = array();

                  Method yylex5 has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function yylex5()
                      {
                          $tokenMap = array (
                                1 => 0,
                                2 => 0,
                  Severity: Minor
                  Found in include/smarty/libs/sysplugins/smarty_internal_templatelexer.php - About 1 hr to fix

                    Method yylex6 has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function yylex6()
                        {
                            $tokenMap = array (
                                  1 => 0,
                                  2 => 0,
                    Severity: Minor
                    Found in include/smarty/libs/sysplugins/smarty_internal_templatelexer.php - About 1 hr to fix

                      Method _doTable_callback has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function _doTable_callback($matches) {
                              $head        = $matches[1];
                              $underline    = $matches[2];
                              $content    = $matches[3];
                      
                      
                      Severity: Minor
                      Found in include/lib/Michelf/Markdown.php - About 1 hr to fix

                        Function smarty_function_html_options_optoutput has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function smarty_function_html_options_optoutput($key, $value, $selected, $id, $class, &$idx)
                        {
                            if (!is_array($value)) {
                                $_key = smarty_function_escape_special_chars($key);
                                $_html_result = '<option value="' . $_key . '"';
                        Severity: Minor
                        Found in include/smarty/libs/plugins/function.html_options.php - About 1 hr 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 15 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function compile($args, $compiler, $parameter)
                            {
                                $_attr = $this->getAttributes($compiler, $args);
                                $saved_data = $this->closeTag($compiler, array('function'));
                                $_name = trim($saved_data[0]['name'], "'\"");
                        Severity: Minor
                        Found in include/smarty/libs/sysplugins/smarty_internal_compile_function.php - About 1 hr 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 _getTemplatesTreeRecursive has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                        Open

                          private function _getTemplatesTreeRecursive($path) {
                            if( !is_dir($path) ) {
                              return preg_match("/\.tpl$/", $path);
                            } else {
                              $subfiles = scandir($path);
                        Severity: Minor
                        Found in include/classes/template.class.php - About 1 hr 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 getCurrentIP has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                        Open

                          public function getCurrentIP($trustremote=false, $checkcloudflare=true, $checkclient=false, $checkforwarded=true) {
                            $cf = (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) ? $_SERVER['HTTP_CF_CONNECTING_IP'] : false;
                            $client = (isset($_SERVER['HTTP_CLIENT_IP'])) ? $_SERVER['HTTP_CLIENT_IP'] : false;
                            $fwd = (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : false;
                            $remote = (isset($_SERVER['REMOTE_ADDR'])) ? $_SERVER['REMOTE_ADDR'] : @$_SERVER['REMOTE_ADDR'];
                        Severity: Minor
                        Found in include/classes/user.class.php - About 1 hr 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 invalidate has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function invalidate($cid = null, $resource_name = null, $cache_id = null, $compile_id = null, $resource_uid = null)
                            {
                                $now = microtime(true);
                                $key = null;
                                // invalidate everything

                        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