modxcms/revolution

View on GitHub
core/model/modx/modcachemanager.class.php

Summary

Maintainability
F
2 wks
Test Coverage

Function generateContext has a Cognitive Complexity of 106 (exceeds 5 allowed). Consider refactoring.
Open

    public function generateContext($key, array $options = array()) {
        $results = array();
        if (!$this->getOption('transient_context', $options, false)) {
            /** @var modContext $obj */
            $obj= $this->modx->getObject('modContext', $key, true);
Severity: Minor
Found in core/model/modx/modcachemanager.class.php - About 2 days 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 modcachemanager.class.php has 626 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/*
 * This file is part of MODX Revolution.
 *
 * Copyright (c) MODX, LLC. All Rights Reserved.
Severity: Major
Found in core/model/modx/modcachemanager.class.php - About 1 day to fix

    Function generateResource has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

        public function generateResource(modResource & $obj, array $options = array()) {
            $results= array();
            if ($this->getOption('cache_resource', $options, true)) {
                if (is_object($obj) && $obj instanceof modResource && $obj->getProcessed() && $obj->get('cacheable') && $obj->get('id')) {
                    $results['resourceClass']= $obj->_class;
    Severity: Minor
    Found in core/model/modx/modcachemanager.class.php - About 5 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 refresh has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

        public function refresh(array $providers = array(), array &$results = array()) {
            if (empty($providers)) {
                $contexts = array();
                $query = $this->xpdo->newQuery('modContext');
                $query->select($this->xpdo->escape('key'));
    Severity: Minor
    Found in core/model/modx/modcachemanager.class.php - About 5 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 clearCache has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

        public function clearCache(array $paths= array(), array $options= array()) {
            $this->modx->deprecated('2.1.0', 'Use modCacheManager::refresh() instead.');
            $results= array();
            $delObjs= array();
            if ($clearObjects = $this->getOption('objects', $options)) {
    Severity: Minor
    Found in core/model/modx/modcachemanager.class.php - About 4 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 autoPublish has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

        public function autoPublish(array $options = array()) {
            $publishingResults= array();
            $tblResource= $this->modx->getTableName('modResource');
            $timeNow= time();
    
    
    Severity: Minor
    Found in core/model/modx/modcachemanager.class.php - About 4 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 generateContext has 104 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function generateContext($key, array $options = array()) {
            $results = array();
            if (!$this->getOption('transient_context', $options, false)) {
                /** @var modContext $obj */
                $obj= $this->modx->getObject('modContext', $key, true);
    Severity: Major
    Found in core/model/modx/modcachemanager.class.php - About 4 hrs to fix

      Method refresh has 89 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function refresh(array $providers = array(), array &$results = array()) {
              if (empty($providers)) {
                  $contexts = array();
                  $query = $this->xpdo->newQuery('modContext');
                  $query->select($this->xpdo->escape('key'));
      Severity: Major
      Found in core/model/modx/modcachemanager.class.php - About 3 hrs to fix

        Method autoPublish has 71 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function autoPublish(array $options = array()) {
                $publishingResults= array();
                $tblResource= $this->modx->getTableName('modResource');
                $timeNow= time();
        
        
        Severity: Major
        Found in core/model/modx/modcachemanager.class.php - About 2 hrs to fix

          Function generateConfig has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              public function generateConfig(array $options = array()) {
                  $config = array();
                  if ($collection= $this->modx->getCollection('modSystemSetting')) {
                      foreach ($collection as $setting) {
                          $k= $setting->get('key');
          Severity: Minor
          Found in core/model/modx/modcachemanager.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 generateActionMap has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              public function generateActionMap($cacheKey, array $options = array()) {
                  $results= array();
                  $c = $this->modx->newQuery('modAction');
                  $c->select(array(
                      $this->modx->getSelectColumns('modAction', 'modAction'),
          Severity: Minor
          Found in core/model/modx/modcachemanager.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

          Method generateResource has 54 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function generateResource(modResource & $obj, array $options = array()) {
                  $results= array();
                  if ($this->getOption('cache_resource', $options, true)) {
                      if (is_object($obj) && $obj instanceof modResource && $obj->getProcessed() && $obj->get('cacheable') && $obj->get('id')) {
                          $results['resourceClass']= $obj->_class;
          Severity: Major
          Found in core/model/modx/modcachemanager.class.php - About 2 hrs to fix

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

                public function clearCache(array $paths= array(), array $options= array()) {
                    $this->modx->deprecated('2.1.0', 'Use modCacheManager::refresh() instead.');
                    $results= array();
                    $delObjs= array();
                    if ($clearObjects = $this->getOption('objects', $options)) {
            Severity: Minor
            Found in core/model/modx/modcachemanager.class.php - About 1 hr to fix

              Method generateExtensionPackagesCache has 44 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function generateExtensionPackagesCache($cacheKey,array $options = array()) {
              
                      $results = array();
                      $c = $this->modx->newQuery('modExtensionPackage');
                      $c->innerJoin('modNamespace','Namespace');
              Severity: Minor
              Found in core/model/modx/modcachemanager.class.php - About 1 hr to fix

                Method getElementMediaSourceCache has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getElementMediaSourceCache(modElement $element,$contextKey, array $options = array()) {
                        $options[xPDO::OPT_CACHE_KEY] = $this->getOption('cache_media_sources_key', $options, 'media_sources');
                        $options[xPDO::OPT_CACHE_HANDLER] = $this->getOption('cache_media_sources_handler', $options, $this->getOption(xPDO::OPT_CACHE_HANDLER, $options));
                        $options[xPDO::OPT_CACHE_FORMAT] = (integer) $this->getOption('cache_media_sources_format', $options, $this->getOption(xPDO::OPT_CACHE_FORMAT, $options, xPDOCacheManager::CACHE_PHP));
                        $options[xPDO::OPT_CACHE_ATTEMPTS] = (integer) $this->getOption('cache_media_sources_attempts', $options, $this->getOption(xPDO::OPT_CACHE_ATTEMPTS, $options, 10));
                Severity: Minor
                Found in core/model/modx/modcachemanager.class.php - About 1 hr to fix

                  Function generateExtensionPackagesCache has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function generateExtensionPackagesCache($cacheKey,array $options = array()) {
                  
                          $results = array();
                          $c = $this->modx->newQuery('modExtensionPackage');
                          $c->innerJoin('modNamespace','Namespace');
                  Severity: Minor
                  Found in core/model/modx/modcachemanager.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

                  Method generateActionMap has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function generateActionMap($cacheKey, array $options = array()) {
                          $results= array();
                          $c = $this->modx->newQuery('modAction');
                          $c->select(array(
                              $this->modx->getSelectColumns('modAction', 'modAction'),
                  Severity: Minor
                  Found in core/model/modx/modcachemanager.class.php - About 1 hr to fix

                    Function generateNamespacesCache has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function generateNamespacesCache($cacheKey, array $options = array()) {
                            $results = array();
                            $c = $this->modx->newQuery('modNamespace');
                            $c->select($this->modx->getSelectColumns('modNamespace', 'modNamespace'));
                            $c->sortby('name','ASC');
                    Severity: Minor
                    Found in core/model/modx/modcachemanager.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

                    Method generateConfig has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function generateConfig(array $options = array()) {
                            $config = array();
                            if ($collection= $this->modx->getCollection('modSystemSetting')) {
                                foreach ($collection as $setting) {
                                    $k= $setting->get('key');
                    Severity: Minor
                    Found in core/model/modx/modcachemanager.class.php - About 1 hr to fix

                      Method generateNamespacesCache has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function generateNamespacesCache($cacheKey, array $options = array()) {
                              $results = array();
                              $c = $this->modx->newQuery('modNamespace');
                              $c->select($this->modx->getSelectColumns('modNamespace', 'modNamespace'));
                              $c->sortby('name','ASC');
                      Severity: Minor
                      Found in core/model/modx/modcachemanager.class.php - About 1 hr to fix

                        Function generateScript has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function generateScript(modScript &$objElement, $objContent= null, array $options= array()) {
                                $results= false;
                                if (is_object($objElement) && $objElement instanceof modScript) {
                                    $results= $objElement->getContent(is_string($objContent) ? array('content' => $objContent) : array());
                                    $results = rtrim($results, "\n") . "\nreturn;\n";
                        Severity: Minor
                        Found in core/model/modx/modcachemanager.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 flushPermissions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function flushPermissions() {
                                $ctxQuery = $this->modx->newQuery('modContext');
                                $ctxQuery->select($this->modx->getSelectColumns('modContext', '', '', array('key')));
                                if ($ctxQuery->prepare() && $ctxQuery->stmt->execute()) {
                                    $contexts = $ctxQuery->stmt->fetchAll(PDO::FETCH_COLUMN);
                        Severity: Minor
                        Found in core/model/modx/modcachemanager.class.php - About 35 mins 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 3 locations. Consider refactoring.
                        Open

                                if (!empty($results) && $this->getOption('cache_action_map', $options, true)) {
                                    $options[xPDO::OPT_CACHE_KEY] = $this->getOption('cache_action_map_key', $options, 'action_map');
                                    $options[xPDO::OPT_CACHE_HANDLER] = $this->getOption('cache_action_map_handler', $options, $this->getOption(xPDO::OPT_CACHE_HANDLER, $options));
                                    $options[xPDO::OPT_CACHE_FORMAT] = (integer) $this->getOption('cache_action_map_format', $options, $this->getOption(xPDO::OPT_CACHE_FORMAT, $options, xPDOCacheManager::CACHE_PHP));
                                    $options[xPDO::OPT_CACHE_ATTEMPTS] = (integer) $this->getOption('cache_action_map_attempts', $options, $this->getOption(xPDO::OPT_CACHE_ATTEMPTS, $options, 1));
                        Severity: Major
                        Found in core/model/modx/modcachemanager.class.php and 2 other locations - About 1 day to fix
                        core/model/modx/modcachemanager.class.php on lines 424..434
                        core/model/modx/modcachemanager.class.php on lines 473..483

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

                        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 3 locations. Consider refactoring.
                        Open

                                if (!empty($results) && $this->getOption('cache_extension_packages', $options, true)) {
                                    $options[xPDO::OPT_CACHE_KEY] = $this->getOption('cache_extension_packages_key', $options,'namespaces');
                                    $options[xPDO::OPT_CACHE_HANDLER] = $this->getOption('cache_extension_packages_handler', $options, $this->getOption(xPDO::OPT_CACHE_HANDLER, $options));
                                    $options[xPDO::OPT_CACHE_FORMAT] = (integer) $this->getOption('cache_extension_packages_format', $options, $this->getOption(xPDO::OPT_CACHE_FORMAT, $options, xPDOCacheManager::CACHE_PHP));
                                    $options[xPDO::OPT_CACHE_ATTEMPTS] = (integer) $this->getOption('cache_extension_packages_attempts', $options, $this->getOption(xPDO::OPT_CACHE_ATTEMPTS, $options, 1));
                        Severity: Major
                        Found in core/model/modx/modcachemanager.class.php and 2 other locations - About 1 day to fix
                        core/model/modx/modcachemanager.class.php on lines 391..401
                        core/model/modx/modcachemanager.class.php on lines 424..434

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

                        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 3 locations. Consider refactoring.
                        Open

                                if (!empty($results) && $this->getOption('cache_namespaces', $options, true)) {
                                    $options[xPDO::OPT_CACHE_KEY] = $this->getOption('cache_namespaces_key', $options,'namespaces');
                                    $options[xPDO::OPT_CACHE_HANDLER] = $this->getOption('cache_namespaces_handler', $options, $this->getOption(xPDO::OPT_CACHE_HANDLER, $options));
                                    $options[xPDO::OPT_CACHE_FORMAT] = (integer) $this->getOption('cache_namespaces_format', $options, $this->getOption(xPDO::OPT_CACHE_FORMAT, $options, xPDOCacheManager::CACHE_PHP));
                                    $options[xPDO::OPT_CACHE_ATTEMPTS] = (integer) $this->getOption('cache_namespaces_attempts', $options, $this->getOption(xPDO::OPT_CACHE_ATTEMPTS, $options, 1));
                        Severity: Major
                        Found in core/model/modx/modcachemanager.class.php and 2 other locations - About 1 day to fix
                        core/model/modx/modcachemanager.class.php on lines 391..401
                        core/model/modx/modcachemanager.class.php on lines 473..483

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

                        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 ($stmt) {
                                    $stmt->bindValue(1, 0);
                                    if ($stmt->execute()) {
                                        foreach ($stmt->fetchAll(PDO::FETCH_NUM) as $value) {
                                            $minunpub= $value[0];
                        Severity: Major
                        Found in core/model/modx/modcachemanager.class.php and 1 other location - About 2 hrs to fix
                        core/model/modx/modcachemanager.class.php on lines 658..672

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

                        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 ($stmt) {
                                    $stmt->bindValue(1, 0);
                                    if ($stmt->execute()) {
                                        foreach ($stmt->fetchAll(PDO::FETCH_NUM) as $value) {
                                            $minpub= $value[0];
                        Severity: Major
                        Found in core/model/modx/modcachemanager.class.php and 1 other location - About 2 hrs to fix
                        core/model/modx/modcachemanager.class.php on lines 677..690

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

                        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

                        There are no issues that match your filters.

                        Category
                        Status